Sign inSign up

usman/django

By usman

Updated almost 11 years ago

Image
0

931

usman/django repository overview

docker-django

Building

git clone [email protected]:usmanismail/docker-django.git
cd docker-django
docker build -t django .

Creating and Setting up a new project

Note this is only needed if you have not already setup your project through django.

# Start initial project
docker run -it -v $PWD:/var/site django django-admin.py startproject mysite

# Add static root
echo 'STATIC_ROOT = os.path.join(BASE_DIR, "static/")' >> mysite/mysite/settings.py

# collect static files for serving with nginx
docker run -it -v $PWD:/var/site django python /var/site/mysite/manage.py collectstatic

# If you are using an internal sqlite (the default setup uses this) but you don't want to do this in production.
docker run -it -v $PWD:/var/site django python /var/site/mysite/manage.py migrate

# Actually run django
docker run --rm -it -v $PWD:/var/site -p 8000:8000 -e SITE_NAME=mysite django

Browse to localhost:8000 in a web browser of your choice. You should see:

It worked!
Congratulations on your first Django-powered page.

If you are using boot2docker you should lookup your docker interface by using boot2docker ip and browse to the IP specified by this command instead of localhost

Tag summary

Content type

Image

Digest

sha256:b47696026

Size

232.5 MB

Last updated

almost 11 years ago

docker pull usman/django