A docker-based Project running Django application with Mysql.
Python 2.7
pip
https://pypi.python.org/pypi/pip
Create a virtual environment djangodocker
and activate.
pip install virtualenv
virtualenv djangodocker
cd djangodocker
source bin/activate
git clone git@github.com:sitture/docker-django-cd.git .
pip install -r requirements.txt
Once the above packages are installed successfully, you should then be able to run the django server.
To run the application locally, open the file src/django_app/settings/local.py
and set DEBUG
to True
.
cd src
python manage.py runserver
From the src
directory, run the below to execute tests.
python manage.py test
If you are comfortable using Docker, you can build this image, run it using sqlite inner database or run it using docker compose along with a MySQL server.
As you can imagine, the only command to build this image is:
docker build -t docker-django:0.1.0 .
If the image fails on the building process, check out the log, could be failing tests.
Once the image is built, you can run it:
docker run -d -p 8000:8000 docker-django:0.1.0
You can run this image using the docker-compose.yml
file. Using it you can test this application with a MySQL Server configuration. In order to get this stack running locally:
docker-compose up -d
This stack uses a .env
file containing the environment variables needed to run both web and database server.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request