Skip to content

Getting Started

Nathan Jean edited this page Mar 23, 2018 · 10 revisions

(commands are assuming Ubuntu. translate apt-get and systemctl to the equivalents for other distros)
(I likely forgot some things, please add on)

Requirements

Python 3.6 sudo apt-get install python3
MySQL: sudo apt-get install mysql-server * Will prompt for a root password while setting up, this is optional
Pip: sudo apt-get install python3-pip

Django my complain without these:
sudo apt-get install libmysqlclient-dev
pip3 install mysqlclient

Run sudo pip3 install -r requirements.txt in the root directory of the project to automatically install all required python libraries

Database

Enable and start mysql server:
sudo systemctl enable mysqld
sudo systemctl start mysqld

Run mysql: sudo mysql -u root -p
Create database in mysql: CREATE DATABASE BlueDawnAnalysis; Run migrations (initialize the database): ./manage.py migrate (May have to run sudo python3 manage.py migrate instead)

Database settings are contained in the file website/settings.py. Here you can change any information that is needed for you locally, like password for mysql. (Make sure you don't commit your password!)

Running the Server

./manage.py runserver: Run the server. Website can be accessed on 127.0.0.1:8000 or localhost:8000.
(Similar to above, you may need to run sudo python3 manage.py runserver) ./managepy createsuperuser: Create a superuser account on the website. (May also apply to this(sudo python3 manage.py createsuperuser), although that is untested)

Importing Data

You will need first login to the admin page (127.0.0.1:8000/admin) Then enter the credentials on the user you made and login Now you can upload data! 👍

If You Are Using Windows...

You will need Python 3.5 minimum https://www.python.org/downloads/

Once you download Python, unzip the folder and follow the instructions in the readme file. Make sure python and pip are on your path. For help changing your path, here are some steps https://www.howtogeek.com/118594/how-to-edit-your-system-path-for-easy-command-line-access/

Next, you will need MySQL https://dev.mysql.com/downloads/installer/

Follow the setup wizard. If it says there is an issue connecting to python 3.5, ignore it. I haven't had any issues without the connectors.

Finally, install django using pip: pip install -r requirements.txt

To run python, pip, or MySQL you may need to have administrator privileges (when opening powershell, right-click and select "run as administrator").