This is a sample project needed for a security course to "connect web service to database".
It connects to the PostgreSQL database with basic authentication. On this web server, you can make a gateway with Nginx It would be better if you do it in the docker network so web app would not have internet access, and it would be a true gateway. But easier is to send requests to localhost:8000 from Nginx.
It would be much easier with docker. Just run docker compose up
(or docker-compose up
if you have an older version).
The server will start on http://localhost:8000
, and it will be also available from the network. If you want to disable it
just modify Dockerfile
in the last row from 0.0.0.0:8000
to localhost:8000
, and rebuild containers if you started them
already docker compose up --build
.
localhost:8000/admin
- authentication page
You need to enter the container and create user (you can see how to do this on screenshot)
pip install poetry
poetry install
# start database
# modify src/secufaku/settings.py and set user, password for database
python src/manage.py runserver 0.0.0.0:8000
You are recommended to modify docker-compose.yml
environment variables for the database and in python block too.
Since I was in hurry and was not in a mood to fix static files in docker. Please don't judge me for that 😅. You can do this if you want. Just make a pull request!