I'm now working on a Web application which is based on Django-1.8.2 and on virtual env provided by Python-3.4.3 of Ubuntu-15.04.
My app. is now working on the development server, and has been successfully deployed using mod_wsgi-4.4.11 (pip installed) and Ubuntu's Apache. That is, after collecting static files and modifying the file permissions of db.sqlite3, I did ...
sudo ../bin/python manage.py runmodwsgi --setup-only --port=80 --user www-data --group www-data --server-root=/etc/mod_wsgi-express-80
sudo /etc/mod_wsgi-express-80/apachectl start
to have a working server.
I'd like the daemons to start up on boot-up automatically, but I have no luck in writing an init.d script or a config file. Probably, an utterly new way is required for the systemd of 15.04. Any suggestions will be welcome.
Looks like the question is about Ubuntu systemd launcher rather than django + mod_wsgi...
After struggling with init.d scripts, I have moved over to systemd service file:
/lib/systemd/system/apache_mod_wsgi.service
[Unit]
Description=apache2 with mod_wsgi
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/etc/mod_wsgi-express-80/apachectl start
ExecStop=/etc/mod_wsgi-express-80/apachectl stop
[Install]
WantedBy=multi-user.target
With this file saved, I killed the native apache2 service and enabled the new service...
fukuda@ubuntu:~% sudo update-rc.d apache2 remove
fukuda@ubuntu:~% sudo systemctl enable apache_mod_wsgi.service
fukuda@ubuntu:~% sudo reboot
The daemons have started successfully, and the django application seems working properly (that is, is responding in an exactly same manner with "manually started" version and the development server.
The only concern is that dmesg would not report the starting up of the service.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With