I am able to run one django project through Apache server. I have two projects: yota_admin_module and yotasite. My Apache conf file: /etc/apache2/sites-available/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
Alias /static /home/abhay/django-project/yota_admin_module/yota/static/
WSGIDaemonProcess yota_admin_module python-path=/home/abhay/django-project/yota_admin_module:/usr/local/lib/python2.7/site-packages
WSGIProcessGroup yota_admin_module
WSGIScriptAlias / /home/abhay/django-project/yota_admin_module/yota_admin_module/wsgi.py
<Directory /home/abhay/django-project/yota_admin_module/ >
Require all granted
</Directory>
# 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
But now I am facing problem when trying to run another django project with that Apache server. So, what I did: inside /etc/apache2/sites-available/000-default.conf modified in this way:
<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
Alias /static /home/abhay/django-project/yota_admin_module/yota/static/
WSGIDaemonProcess yota_admin_module python-path=/home/abhay/django-project/yota_admin_module:/usr/local/lib/python2.7/site-packages
WSGIProcessGroup yota_admin_module
WSGIScriptAlias / /home/abhay/django-project/yota_admin_module/yota_admin_module/wsgi.py
<Directory /home/abhay/django-project/yota_admin_module/ >
Require all granted
</Directory>
WSGIDaemonProcess yotasite python-path=/home/abhay/django-project/yotasite:/usr/local/lib/python2.7/site-packages
WSGIProcessGroup yotasite
WSGIScriptAlias / /home/abhay/django-project/yotasite/yotasite/wsgi.py
<Directory /home/abhay/django-project/yotasite/ >
Require all granted
</Directory>
# 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
So, after modifying this when "sudo service apache2 restart" is given getting error:
[Tue Aug 25 13:21:20.325955 2015] [mpm_event:notice] [pid 4761:tid 140704687433600] AH00491: caught SIGTERM, shutting down
[Tue Aug 25 13:21:21.491426 2015] [mpm_event:notice] [pid 4895:tid 140635456407424] AH00489: Apache/2.4.12 (Ubuntu) mod_wsgi/3.4 Python/2.7.6 configured -- resuming normal operations
[Tue Aug 25 13:21:21.491930 2015] [core:notice] [pid 4895:tid 140635456407424] AH00094: Command line: '/usr/sbin/apache2'
[Tue Aug 25 13:21:34.751733 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] mod_wsgi (pid=4899): Target WSGI script '/home/abhay/django-project/yota_admin_module/yota_admin_module/wsgi.py' cannot be loaded as Python module.
[Tue Aug 25 13:21:34.752015 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] mod_wsgi (pid=4899): Exception occurred processing WSGI script '/home/abhay/django-project/yota_admin_module/yota_admin_module/wsgi.py'.
[Tue Aug 25 13:21:34.752198 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] Traceback (most recent call last):
[Tue Aug 25 13:21:34.752358 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] File "/home/abhay/django-project/yota_admin_module/yota_admin_module/wsgi.py", line 17, in <module>
[Tue Aug 25 13:21:34.752715 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] application = get_wsgi_application()
[Tue Aug 25 13:21:34.752865 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 14, in get_wsgi_application
[Tue Aug 25 13:21:34.753125 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] django.setup()
[Tue Aug 25 13:21:34.753255 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 17, in setup
[Tue Aug 25 13:21:34.753513 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Tue Aug 25 13:21:34.753654 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 48, in __getattr__
[Tue Aug 25 13:21:34.754139 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] self._setup(name)
[Tue Aug 25 13:21:34.754294 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 44, in _setup
[Tue Aug 25 13:21:34.754445 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] self._wrapped = Settings(settings_module)
[Tue Aug 25 13:21:34.754557 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 92, in __init__
[Tue Aug 25 13:21:34.754693 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] mod = importlib.import_module(self.SETTINGS_MODULE)
[Tue Aug 25 13:21:34.754800 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Tue Aug 25 13:21:34.755095 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] __import__(name)
[Tue Aug 25 13:21:34.755256 2015] [:error] [pid 4899:tid 140635300349696] [remote 127.0.0.1:27198] ImportError: No module named settings
So, I need some guidance to fix this to run two django projects with Apache server.