Restful API for NewAra @ SPARCS
Python 3.7
pip 19.2
poetry
is used as package manager
Django 2.2
djangorestframework 3.10
- MySQL (default)
mysqlclient 1.4
django-mysql 3.2
Works with MySQL for Linux & macOS, not tested in Windows. Timezone is automatically adjusted. It is strongly recommended to set default charset of database or MySQL server to utf8mb4
.
- AWS S3
django-s3-storage 0.12
Two buckets are used - one for storing static files, one for media files that users upload. Go to django-s3-storage documentation for required permissions.
- SPARCS SSO v2 API
djangorestframework TokenAuthentication
drf-yasg 1.16
Miscellaneous packages are listed in
requirements.txt
.
$ python3 -m venv env
$ source env/bin/activate
$ pip install poetry
$ poetry install # in production - $ poetry install --no-dev
For macOS, you may need to install openssl
& mysqlclient
and set LDFLAGS=-L/usr/local/opt/openssl/lib
before installing requirements. Only tested for macOS Mojave. See link.
Copy .env
file and fill required informations. informations. For SPARCS SSO, create a test service or ask SYSOP to deploy production server.
$ python manage.py migrate
migrate
command creates required tables in the database. You also need to makemigrations
& migrate
if you changed the models - Django will alter tables for you.
$ python manage.py collectstatic
collectstatic
command collects all static files required to run installed apps to selected storage - for this project, static S3 bucket. You should open public access for the static bucket to get appropriate response.
$ python manage.py runserver 0:<port>
0
is abbreviation for 0.0.0.0
which refers to 'listening to every incoming hosts'. Do not deploy with runserver command - use WSGI. This command is only for development.
WIP
WIP
See contributors.