Skip to content
Django based REST api server for the foster app
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
foster
foster_server
.dockerignore
.env.example
.gitignore
Dockerfile
LICENSE
README.md
docker-compose.check.yml
docker-compose.development.yml
docker-compose.production.yml
docker-compose.yml
manage.py
requirements.txt

README.md

Foster Server

Initialize

Database migration (at first run, or after updates)

locally:

python manage.py migrate

(for this you must set the SECRET_KEY env var first)

or with docker:

docker exec -it container_id python manage.py migrate

Create super-admin user

(Note: locally is better used with virtual-env)

locally:

python manage.py createsuperuser 

or with docker:

docker exec -it container_id python manage.py createsuperuser

you can also use this:

python manage.py createsuperuser --email admin@example.com --username admin

Run server

development notes

Make sure, before first run, to set the environment variables:

DJANGO_SETTINGS_MODULE=foster_server.settings_dev
SECRET_KEY=a-@$183+3zjsnf8c#bi0t!5rwqud!y3y(n5$pb%-1dm0@b4k!8

production notes

Make sure, before first run, to set the environment variables:

DJANGO_SETTINGS_MODULE=foster_server.settings_prod
SECRET_KEY=a-@$183+3zjsnf8c#bi0t!5rwqud!y3y(n5$pb%-1dm0@b4k!8

IMPORTANT!!!! update the SECRET_KEY to unique value!!!

or, if using docker:

create copy of the docker-compose.production.yml to docker-compose.override.yml which will set this up for you.

make an .env file from the .env.example file, and set the SECRET_KEY variable inside to unique value.

Test production settings

to test Production configuration use:

docker-compose -f docker-compose.yml -f docker-compose.check.yml up

add --build if changes was made to the settings.prod.py file after first build

run server

locally:

python manage.py runserver 8080

or with docker:

docker-compose up -d

Development

Create new migration

python manage.py makemigrations foster
python manage.py sqlmigrate foster 0001

(for this you must set the SECRET_KEY env var first)

You can’t perform that action at this time.