Skip to content

🐍 🐳 A cookie-cutter Docker instance of Django with basic CRUD features

Notifications You must be signed in to change notification settings

hackathon-mentors/hackathon-django-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Hackathon Django Starter

This is a quick template for starting a Django app on a Docker container with postgresql.

Instructions

In docker-compose.yml, change the values of POSTGRES_DB, POSTGRES_USER, and POSTGRES_PASSWORD.

Run the following command to create a new app:

docker-compose run web django-admin startproject <YOUR_APP_NAME> .

Replace <YOUR_APP_NAME> with your desired app name. Don't forget the period . at the end, that specifies the current directory!

Once created, open <YOUR_APP_NAME>/settings.py file and replace the DATABASES = ... with the following:

# settings.py

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'postgres',      # Your POSTGRES_DB value
        'USER': 'postgres',      # Your POSTGRES_USER value
        'PASSWORD': 'postgres',  # Your POSTGRES_PASSWORD value     ... from docker-compose.yml
        'HOST': 'db',
        'PORT': 5432,
    }
}

Bring up the containers:

docker-compose up

Visit http://localhost:8000/ to see Django's hello world page.

About

🐍 🐳 A cookie-cutter Docker instance of Django with basic CRUD features

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published