Skip to content

Dummy project for learning purposes. A dockerized Django blog application. Render will build the app, not run the Docker images.

License

Notifications You must be signed in to change notification settings

memphis-tools/dummy_django_app_on_render

Repository files navigation

Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Coverage Status CircleCI Known Vulnerabilities

DUMMY APP FOR LEARNING PURPOSES

This is dummy django blog application.

In the cloud context, application is hosted on Render as a Python app, so Docker, Gunicorn, Nginx are not used.

Locally you will run the application using Docker (with Gunicorn and Nginx).

The CI-CD chain consists in using Circle-ci.

A dummy Django application for learning purposes, to practise. Focus is set on the backend, do not pay attention to the frontend (HTML, CSS & Javascript).

Also more tests and logging will be added later on.

You can find this dummy blog app at https://dummy-django-app-on-render.onrender.com/

Because of a free instances plan, Render will spin down with inactivity, which can delay requests by 50 seconds or more.

TECHNOLOGIES


Python 3.11 and later

Sqlite3

Gunicorn

Nginx

Docker (docker-compose), DockerHub

Circle-CI

Coveralls

HOW USE IT ?

git clone https://github.com/memphis-tools/dummy_django_app_on_render.git

cd dummy_django_app_on_render

poetry install

source $(poetry env info --path)/bin/activate

EXECUTION PREQUISITES

For a local usage set an envrc file such like this:

export SECRET_KEY="superSecretKey"
export ALLOWED_HOSTS="localhost,127.0.0.1"
export DEBUG=0
export TIME_ZONE="Europe/Paris"
export DOCKER_HUB_USER='yourDockerhubUsername'
export DOCKER_HUB_PASSWORD='yourDockerhubPassword'
export IS_TESTING=False
export AWS_ACCESS_KEY_ID="your_aws_access_key_id"
export AWS_SECRET_ACCESS_KEY="your_aws_secret_access_key"
export AWS_DEFAULT_REGION="your_aws_region"
export EMAIL_HOST="localhost"
export EMAIL_PORT=25
export EMAIL_USE_TLS=False
export EMAIL_HOST_USER="admin@django_app_on_render.dev"
export EMAIL_HOST_PASSWORD=""

The Django settings.py will load the file (with load_dotenv).

RUN IT

To avoid manual commands, use the dummy "docker-compose-deployment.sh".

To build the images locally:

./docker-compose-deployment.sh build

To publish the built images on Dockerhub:

./docker-compose-deployment.sh publish

To run the local images and stop app:

./docker-compose-deployment.sh run_dev

./docker-compose-deployment.sh down_dev

To run the Dockerhub images and stop app:

./docker-compose-deployment.sh run_prod

./docker-compose-deployment.sh down_prod

Notice: the './docker-compose-deployment.sh cloud' command is only run by Render.

Once running locally, you can access the application at: http://localhost:5555/

TO TEST IT

source .env

source .venv/bin/activate

coverage run -m pytest dummy_django_blog/

coverage report

About

Dummy project for learning purposes. A dockerized Django blog application. Render will build the app, not run the Docker images.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published