Skip to content

Setup Nginx+Django+uWSGI+MySQL for development purpose with docker-compose.

Notifications You must be signed in to change notification settings

rockbone/docker-compose_nginx-django-mysql_template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

Setup Nginx+Django+uWSGI+MySQL for development purpose with docker-compose.

USAGE

# create django project
docker-compose run python django-admin.py startproject mysite .

# create app
docker-compose run python python manage.py startapp app

# add settings.py
    # to use mysql
    import pymysql
    pymysql.install_as_MySQLdb()
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'NAME': 'app',
            'USER': 'app',
            'PASSWORD': 'app',
            'HOST': 'db',
            'PORT': '3306',
        }
    }
    # specify static directory
    STATIC_ROOT = '/static'

# migrate database
docker-compose run python ./manage.py makemigrations
docker-compose run python ./manage.py migrate

# collect static
docker-compose run python ./manage.py collectstatic

# create superuser
docker-compose run python ./manage.py createsuperuser

# boot up docker
docker-compose up -d

# check site
http://localhost:8000/admin

About

Setup Nginx+Django+uWSGI+MySQL for development purpose with docker-compose.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published