ibis777
Posts: 8
Joined: Tue Jan 15, 2019 2:36 am
Location: Colonia, Uruguay

Run Django project on startup

Wed Feb 27, 2019 7:11 am

Hi everyone!

I need to run a django project every time I turn on my Raspberry, and I don´t know how to do it. I have seen that if I want to run a Python script on startup, I can create a new file on /etc/init.d/ with a content like this (by the way, I´m working on Raspbian Stretch):

#! /bin/sh
### BEGIN INIT INFO
# Provides: ...
# Enconding: UTF-8
# Required-Start:
# Required-Stop:
# Should-Start:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: ...
# Description: ...
#
# X-Interactive: true
### END INIT INFO

(The code)
exit 0

And then, changing some privileges and typing the path of the file in /etc/rc.local (like: sudo /etc/init.d/my_file start) I can make it run when the Raspberry starts.
However, I can´t make it work with a django project, in which I have to work on a virtual environment and run the project from manage.py with runserver, in an especific IP.
Does anyone knows how it is done?
Thanks!

Return to “Python”