This is a Django API connected to a MySQL database to store and retrieve Gw2 percentile data.
If you haven't already...
Skip this step if already installed. Download and install Python for your OS.
cd /your_project_folder/
git clone https://github.com/Mapleia/LogCompareAPI.git
Skip this step if already installed. Download and install MySQL for your OS.
If you know how, open MySQL command line. Otherwise, from your MySQL dev default install, open MySQL Client Command Line. Open, then login. From MySQL command line, create the database if you haven't already.
CREATE DATABASE logcomparedb;
To confirm:
SHOW DATABASES;
You should see "logcomparedb".
-
Setup virtual environment (this is an example for VS Code).
a. If not already in the LogCompareAPI folder,
cd /LogCompareAPI/
else, skip to b.
b. Install virtualenv. If already installed, skip to c.
pip install virtualenv
c. Create virtual environment with virtualenv.
virtualenv venv
d. Activate virtual environment. (shell script)
venv/Scripts/activate
-
Install requirements.
Once your virtual environment is running, the terminal should show:
(venv) C:\path_to_project_folder\LogCompareAPI>
In here, pip install the requirements.
pip install -r requirements.txt
-
Setup your .env file to store your secrets. Create a file in the home directory of the project (C:\path_to_project_folder\LogCompareAPI) called .env.
DB_PASS='INSERT YOUR DATABASE PASSWORD HERE' SECRET_KEY='INSERT SECRET DJANGO KEY HERE' NAME='logcomparedb' USER='INSERT LOCAL DB USERNAME HERE' HOST='localhost' ENVIRONMENT='DEV'
While you're still in your virtual environment:
py manage.py makemigrations
py manage.py migrate
If you'd like to create an admin account run the commands below to be taken through the process of setting up an admin account.
py manage.py createsuperuser
py manage.py runserver