Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (19.9k points)

I have created an app with Django, on my Raspberry Pi, as part of my smart home project. Now that I am coming to the end of the project, I would like to make it so that I can run one script and have all of the features of the smart home working. (This would be especially useful as then I can just make it run on boot without having to connect a screen or ssh).

What I would like to know is if there is a way I can make a python script that will run the whole Django app so that I don't have to go into terminal and set it up. Is this possible? and if not what is the best way to go about my issue?

1 Answer

0 votes
by (25.1k points)

Yes you can do that you set the autologin in raspi-config then create a shell script run.sh

like this

python /path/to/project.manage.py runserver 0.0.0.0:8000

or you can use gunicorn proxy

You can also start other servers in this file

then put sh run.sh in you .bashrc.

Better way

You can install tmux by apt-get install tmux You can make detached session using tmux in run.sh using a unique name and tmux so that each time you open the prompt it wont create duplicate sessions.

Browse Categories

...