Dockerfile for Django development
A basic docker image for Django development. Please, only use this image for development purposes!
This image is based on CentOS 7 (EPEL repository enabled) and uses Python 2.7, pip 1.3.1 and Django 1.7.1.
How to use it?
In few words, only two commands:
$ docker run -t -i -v /path/to/your/django/app:/home/django/app -p 80:8000 marienfressinaud/django (docker)$ runserver
That's all! Now you can access your Django application on http://localhost, write your code with your favorite text editor and use the Django CLI whitout installing it directly on your computer. This image also contains vim and git softwares.
docker run [...] will download corresponding image from Docker hub, mount your app on the correct directory and map your port 80 on port 8000 of development server from the container which you can run with the
What if you didn't create any application yet?
First, run your docker container as explained previously. At this step
/path/to/your/django/app folder should be empty.
Now you just have to create your project. For instance:
(docker)$ pwd /home/django/app (docker)$ django-admin.py startproject mysite .
Don't forget the final dot (.) or an additional folder will be created to store your app.