Sorin M
Sorin M

Reputation: 73

Run "python manage.py runserver" from a bash script

I want to run "python manage.py runserver" from a bash script

First if I wanted to run from a terminal "python manage.py runserver &" but it doesn't work. I found the fix for this in (https://code.djangoproject.com/changeset/16327). Manually in a terminal running "python manage.py runserver &" works fine. I've added in a bash script "python manage.py runserver &" but it doesn't start the server.

Error:
File "/usr/local/lib/python2.7/dist-packages/Django-1.3-py2.7.egg/django/utils/autoreload.py", line 137, in main
    reloader(main_func, args, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.3-py2.7.egg/django/utils/autoreload.py", line 110, in python_reloader
    reloader_thread()
  File "/usr/local/lib/python2.7/dist-packages/Django-1.3-py2.7.egg/django/utils/autoreload.py", line 89, in reloader_thread
    ensure_echo_on()
  File "/usr/local/lib/python2.7/dist-packages/Django-1.3-py2.7.egg/django/utils/autoreload.py", line 77, in ensure_echo_on
    attr_list = termios.tcgetattr(fd)
termios.error: (25, 'Inappropriate ioctl for device')

Upvotes: 7

Views: 11350

Answers (2)

Jiaaro
Jiaaro

Reputation: 76948

The problem is probably that hudson is not running as your user... you could run

source /home/your_user/.bashrc && django_serve 

to make it run that alias, but I think you'll probably need to switch users

-- or --

have hudson run the dev server from it's own checkout of the source

Edit: Looking at your erro though, I think this may solve your problem:

instead of

python manage.py runserver

try adding the --noreload flag to disable the auto reloader

python manage.py runserver --noreload

Upvotes: 6

sultan
sultan

Reputation: 6058

I use alias to start django server. May be can help)

Just add alias django_serve="python manage.py runserver &" at the end of your ~/.bashrc or ~/.profile.

Also you create .bash_aliases and place your aliases into this file and execute it before you make any actions like


if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

Upvotes: 0

Related Questions