The API server for accessing content across the ASWWU websites. Built with Django 2, the Django REST Framework, and Python 3.7.
Use these steps to setup your local developemnt environment.
MySQL can be installed with Brew (not recommended), MAMP (easy but big), or Docker (hard but lightweight). Use MySQL version 5.7.22.
- Install with brew
$ brew install mysql
- Save yourself a lot of pain and skip to the Docker section
- Download and install MAMP
- Start servers
- Skip to database setup
- Install MySQL server
$ docker run -d \ -p 8889:3306 \ -e MYSQL_ROOT_PASSWORD=root \ --name=mysql-server \ mysql/mysql-server:5.7.22
- Enter the MySQL command line, you may need to restart the container first
$ docker exec -it mysql-server mysql -uroot -proot
- Give the root user permission on localhost
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root';
- Create the databases, use Docker step 2 to enter the MySQL command line if necessary
mysql> CREATE DATABASE django CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; mysql> CREATE DATABASE elections CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; mysql> CREATE DATABASE jobs CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; mysql> CREATE DATABASE pages CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; mysql> CREATE DATABASE people CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
- Install dependencies. NOTE: mysqlclient can cause issues on Mac. Ensure that you installed mysql with brew
$ pipenv install
- Run migrations
$ pipenv run python manage.py migrate
- Run server
$ pipenv run python manage.py runserver