Wednesday, August 29, 2018

Deploying with apache2 and modwsgi

After working with the development server for a month, I'm ready to
deploy to a VPS.
I've installed a debian9 environment and installed apache2 and
modwsgi. I'm having trouble editing the httpd.conf and apache wont
start with the added lines.

My project is at /home/joel/myappointments and the tree looks like this:
root@localhost:/home/joel/myappointments# tree -L 2
├── appointments
│ ├──
│ ├──
│ ├──
│ ├── migrations
│ ├──
│ ├── __pycache__
│ ├── static
│ ├── templates
│ ├──
│ ├──
│ ├── using shell.txt
│ └──
├── bugs.txt
├── db.sqlite3
├── django-todo.txt
├── myappointments
│ ├──
│ ├──
│ ├── __pycache__
│ ├──
│ ├──
│ ├──
│ └──
├── notebook.tex
├── propellor
│ ├── button.css
│ ├── floating-action-button.css
│ ├── materialicons.css
│ └── typography.css
├── requirements.txt
├── requirements.txt~
└── venv
├── bin
├── include
├── lib
└── pip-selfcheck.json

My apache conf is /home/joel/myappointments# cat
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf

WSGIScriptAlias / /home/joel/myappointments/myappointments/
WSGIPythonHome /home/joel/myappointments/venv
WSGIPythonPath /home/joel/myappointments

<Directory /home/joel/myappointments>
Require all granted


# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Can you tell me how to modify my apache conf file?

You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment