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
│ ├── admin.py
│ ├── apps.py
│ ├── forms.py
│ ├── migrations
│ ├── models.py
│ ├── __pycache__
│ ├── static
│ ├── templates
│ ├── tests.py
│ ├── urls.py
│ ├── using shell.txt
│ └── views.py
├── bugs.txt
├── db.sqlite3
├── django-todo.txt
├── manage.py
├── myappointments
│ ├── __init__.py
│ ├── middleware.py
│ ├── __pycache__
│ ├── settings.py
│ ├── settings.py~
│ ├── urls.py
│ └── wsgi.py
├── notebook.tex
├── propellor
│ ├── button.css
│ ├── floating-action-button.css
│ ├── materialicons.css
│ └── typography.css
├── README.md
├── requirements.txt
├── requirements.txt~
└── venv
├── bin
├── include
├── lib
└── pip-selfcheck.json

My apache conf is /home/joel/myappointments# cat
/etc/apache2/sites-enabled/000-default.conf:
<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.
#ServerName www.example.com

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/wsgi.py
WSGIPythonHome /home/joel/myappointments/venv
WSGIPythonPath /home/joel/myappointments

<Directory /home/joel/myappointments>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

</VirtualHost>

# 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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA%3Diw_-ayMNk1CWkxQ7vaDwOwccC9t9hEXACF3Z20ifzgTg1Fw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment