Question
How to set up Wordpress 1-click with Django backend on same url ?
Hello everyone,
I have set up a Wordpress 1-click app on a Ubuntu droplet (16.04).
I have installed a simple Django project (works on http://localhost:8000) and configured it with VirtualHost to reach it a http://localhost/backend.
It does not work : on this url I got a 404 error page from Wordpress.
I would like to know if it possible first ? (from that post it seems possible https://www.digitalocean.com/community/questions/django-and-wordpress-on-wp-one-click-installation-ubuntu, but is it on the same url ?)
Here are the steps I have already done:
- Set up wordpress (it works -> http://178.62.62.106/): https://www.digitalocean.com/community/tutorials/how-to-use-the-wordpress-one-click-install-on-digitalocean
- Set up Django with VirtualHost on 80 (does not work) https://www.digitalocean.com/community/tutorials/how-to-run-django-with-mod_wsgi-and-apache-with-a-virtualenv-python-environment-on-a-debian-vps
- I have written a virtual host config file, added the site with a2ensite and then reloaded the apache server.
You can find here my django virtual host config file.
<VirtualHost *:80>
WSGIDaemonProcess django_backend \
python-path=/home/samuel/django_backend:/home/samuel/.virtualenvs/django_backend/lib/python2.7/site-packages
WSGIProcessGroup django_backend
Alias /static/ /home/samuel/django_backend/collected_static/
<Directory /home/samuel/django_backend/collected_static>
Require all granted
</Directory>
WSGIScriptAlias /backend /home/samuel/django_backend/django_backend/wsgi.py
<Directory /home/samuel/django_backend/django_backend>
Order allow,deny
Allow from all
</Directory>
<Directory /home/samuel/django_backend/django_backend>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
# 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
ServerAdmin webmaster@localhost
# DocumentRoot /home/samuel/django_backend/
# 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}/python-django_error.log
CustomLog ${APACHE_LOG_DIR}/python-django_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
</VirtualHost>
Thank you in advance !
Samuel
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×