This repository has been archived by the owner on Nov 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Setting up a local copy of FRC Scout
Sam Wolfson edited this page Feb 26, 2015
·
5 revisions
So, you want to get your own copy of FRC Scout?
*This guide only applies directly to nix based systems -- you will have to modify the instructions slightly if you want to use Windows.
Requirements:
- Python 3.4
- Pip
- Virtualenv
- Sqlite
Instructions:
- Open up terminal, and clone our git repository:
git clone https://github.com/FIRST-4030/frc-scout-2015.git
- You can technically get away without doing this, but I recommend it so you don't muck up your system's Python install. Create a virtual environment wherever you want (I usually just put it in the project directory but it can also be in your home folder, or wherever):
cd <project_folder>
virtualenv <venv_name>
(I usually just name it venv) - To activate your new venv, use:
source <venv_name>/bin/activate
and you should get a new (venv) prefix on your bash prompt. - Now that you're in your venv, you can install the Python requirements for FRC Scout. From the project root directory, type:
pip install -r requirements.txt
That will take a little time to get everything installed. *Note: not everything is applicable to every installation, and some of the requirements will be superfluous. That's why I recommended creating a venv ;) - Once pip is finished, you can start working with Django. First you need to setup the local settings, which will override the global settings.py file with database information and other non-version controlled variables. You can use my local settings file, from my local install, as a template:
DEBUG = True
COMPRESS_ENABLED = True
# Make these unique, and don't share it with anybody.
SECRET_KEY = "03a12404-490c-470a-af1c-b5dad3e6k18356a-b7fe-411b-b880-a7b5c04e23f2790587b7-8984-48-a3f9b6b3b8a1"
NEVERCACHE_KEY = "2a434-39-80ae-40de-89fe7fb4f5696c7e-c347-4ea5-9664-58b23eae0519"
DATABASES = {
"default": {
# Ends with "postgresql_psycopg2", "mysql", "sqlite3" or "oracle".
"ENGINE": "django.db.backends.sqlite3",
# DB name or path to database file if using sqlite3.
"NAME": "dev.db",
# Not used with sqlite3.
"USER": "",
# Not used with sqlite3.
"PASSWORD": "",
# Set to empty string for localhost. Not used with sqlite3.
"HOST": "",
# Set to empty string for default. Not used with sqlite3.
"PORT": "",
}
}
SSL_LOGIN_DISABLED = True
SITE_URL = 'localhost'
(The secret keys here aren't particularly important, since it's only a local install)
Create a new file in the frc_scout_2015/ directory called local_settings.py and paste the info from this file into there, changing things as necessary (SQLite should work fine for a dev environment).
If you submit a pull request, BE SURE TO GITIGNORE THIS FILE.
- Now you need to make your initial database migrations. From the project root, run:
python manage.py syncdb
(follow the prompts)
python manage.py makemigrations
python manage.py migrate
This should setup your database with the correct skeletons. - Finally, import some locations into the database, using handy scripts that have been written for you:
python setup_db.py
imports locations
python import_tba_locations.py
assigns IDs from The Blue Alliance to each location - Now run the server:
python manage.py runserver
and marvel at your brilliance.
I like to use PyCharm for doing Django, because it has a ton of useful, built-in stuff.