1π
At my current gig we setup a bash script called django_admin. You run it like so:
django_admin <management command>
Example:
django_admin syncdb
The script looks something like this:
docker run -it --rm \
-e PYTHONPATH=/var/local \
-e DJANGO_ENVIRON=LOCAL \
-e LC_ALL=en_US.UTF-8 \
-e LANG=en_US.UTF-8 \
-v /src/www/run:/var/log \
-v /src/www:/var/local \
--link mysql:db \
localhost:5000/www:dev /var/local/config/local/django-admin $@
Iβm guessing you could also hook something up like this to manage.py
π€PizzaPanther
1π
I normally wrap my actual CMD in a script that launches a bash shell. Take a look at Docker-Jetty container as an example. The final two lines in the script are:
/opt/jetty/bin/jetty.sh restart
bash
This will start jetty and then open a shell.
Now I can use the following command to enter a shell inside the container and run any commands or look at logs. Once I am done I can use Ctrl-p + Ctrl-q to detach from the container.
docker attach CONTAINER_NAME
π€Usman Ismail
- [Answered ]-How can I get past this "'django_content_type' does not exist" error when deploying with Heroku?
- [Answered ]-Python/Django: virtualenv not recognizing app
- [Answered ]-How do i keep track of user info without having them log in?
- [Answered ]-How to return image in python file? for django
Source:stackexchange.com