Skip to content
/ djadock Public

Simple template for Django + PostgreSQL applications

License

Notifications You must be signed in to change notification settings

ivpal/djadock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Djadock

Simple template for Django + PostgreSQL applications.

Create new Django project

In env.dev replace environment settings for db service.

cd docker/
docker-compose -f docker-compose.dev.yml build web
docker-compose -f docker-compose.dev.yml run web django-admin.py startproject <your_app_name> .

Go to the root folder of your application and change the ownership of the new files:

sudo chown -R $USER:$USER .

In <your_app_name>/settings.py replace the DATABASES = ... with the following:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'HOST': os.environ.get('DB_SERVICE', ''),
        'PORT': os.environ.get('DB_PORT', 5432),
        'NAME': os.environ.get('POSTGRES_DB', ''),
        'USER': os.environ.get('POSTGRES_USER', ''),
        'PASSWORD': os.environ.get('POSTGRES_PASSWORD', ''),
    }
}

Run application:

cd docker/
docker-compose -f docker-compose.dev.yml up -d

To perform console commands inside web container:

docker-compose -f docker-compose.dev.yml exec web bash

About

Simple template for Django + PostgreSQL applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published