Skip to content

vidahealth/public-example-django

Repository files navigation

public-example-django

Simple django app for use in the docker-local-dev blog post.

Related repositories:

pyenv virtualenv 3.9.7 example-django
pip install -r requirements.txt

django-admin startproject tutorial
cd tutorial
./manage.py startapp quickstart

Followed DRF quickstart https://www.django-rest-framework.org/tutorial/quickstart/

testing

when deployed with PyCharm

curl localhost:8000/status

setting up database

We use the postgres admin account for simplicity, so we do not need to create users or give permissions.

# migrate the database
./manage.py migrate
python manage.py createsuperuser
Username: admin
Email address: [email protected]
Password: password

differences from django tutorial

If we did not use the postgres admin user, we would need to create a new user If we did, that might look like the following from local dev postgres (docker exec)

createuser --pwprompt mydatabaseuser
createdb mydatabase -O mydatabaseuser

# enable the test user to create test databases
psql -c "alter user mydatabaseuser createdb" -d mydatabase

if you forgot to set the password of the database user

psql -c "ALTER ROLE mydatabaseuser WITH PASSWORD 'mypassword'"

About

Simple django app for use in the docker-local-dev blog

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published