python - How can I run two django projects through Apache webserver in Ubuntu 14.04? -


i able run 1 django project through apache server. have 2 projects: yota_admin_module , yotasite. apache conf file: /etc/apache2/sites-available/000-default.conf

<virtualhost *:80> # servername directive sets request scheme, hostname , port # server uses identify itself. used when creating # redirection urls. in context of virtual hosts, servername # specifies hostname must appear in request's host: header # match virtual host. default virtual host (this file) # value not decisive used last resort host regardless. # however, must set 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 granted </directory>  # available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # possible configure loglevel particular # modules, e.g. #loglevel info ssl:warn  errorlog ${apache_log_dir}/error.log customlog ${apache_log_dir}/access.log combined  # configuration files conf-available/, # enabled or disabled @ global level, possible # include line 1 particular virtual host. example # following line enables cgi configuration host # after has been globally disabled "a2disconf". #include conf-available/serve-cgi-bin.conf 

but facing problem when trying run django project apache server. so, did: inside /etc/apache2/sites-available/000-default.conf modified in way:

<virtualhost *:80> # servername directive sets request scheme, hostname , port # server uses identify itself. used when creating # redirection urls. in context of virtual hosts, servername # specifies hostname must appear in request's host: header # match virtual host. default virtual host (this file) # value not decisive used last resort host regardless. # however, must set 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 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 granted </directory>   # available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # possible configure loglevel particular # modules, e.g. #loglevel info ssl:warn  errorlog ${apache_log_dir}/error.log customlog ${apache_log_dir}/access.log combined  # configuration files conf-available/, # enabled or disabled @ global level, possible # include line 1 particular virtual host. example # following line enables cgi configuration host # after has been globally disabled "a2disconf". #include conf-available/serve-cgi-bin.conf 

so, after modifying when "sudo service apache2 restart" 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 loaded 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, need guidance fix run 2 django projects apache server.

various things wrong. see comments below.

# best match trailing slashes on both arguments safe. if # leave 1 off on one, can't remember which, final filesystem # path not formed correctly. use have trailing slash on both # or not on either.  alias /static/ /home/abhay/django-project/yota_admin_module/yota/static/  # if needing include /usr/local/lib/python2.7/site-packages # must doing wrong. should included default. # if required, mod_wsgi not compiled python # installation.  wsgidaemonprocess yota_admin_module python-path=/home/abhay/django-project/yota_admin_module:/usr/local/lib/python2.7/site-packages  # can't use wsgiprocessgroup unless scoped directory # of location directive knows django instance applied to. # better use process-group option wsgiscriptalias instead # knows sure. force main interpreter context using # application-group value of %{global}  wsgiscriptalias / /home/abhay/django-project/yota_admin_module/yota_admin_module/wsgi.py \     process-group=yota_admin_module application-group=%{global}  <directory /home/abhay/django-project/yota_admin_module/ >        require granted </directory>  wsgidaemonprocess yotasite python-path=/home/abhay/django-project/yotasite:/usr/local/lib/python2.7/site-packages  # can't have both sites mounted @ root of host. second # 1 hidden first , never requests. # if wanting have both under same server name, need have # 1 @ sub url. sub url must first. before # root of site.  wsgiscriptalias / /home/abhay/django-project/yotasite/yotasite/wsgi.py \     process-group=yotasite application-group=%{global}  <directory /home/abhay/django-project/yotasite/ >        require granted </directory> 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -