Move project to another server with Apache

Hi,

I try first Django project with tutorial. All working on local machine. I try move project to remote server, configured witch Apache WSGI module. First I create manualy test Django project on remote server and all working (Django installed, apache module working).

Now I configure "deployment" on PyCharm IDE a transfer files to remote server. Create virtual environment witch Python 3.5. Update virtualhost of Apache.

When I try connect to remote I get "500 internal server Error".

I try google and JetBrains knowledgebase, but I can't find manual for begginer How to deploy project to Apache server. Can you help me ?

 

From log :


[Tue Oct 24 22:26:55.476704 2017] [wsgi:error] [pid 2665] [remote 10.5.6.196:48804] mod_wsgi (pid=2665): Target WSGI script '/var/www/h
tml/portal/test2/wsgi.py' cannot be loaded as Python module.
[Tue Oct 24 22:26:55.476759 2017] [wsgi:error] [pid 2665] [remote 10.5.6.196:48804] mod_wsgi (pid=2665): Exception occurred processing
WSGI script '/var/www/html/portal/test2/wsgi.py'.
[Tue Oct 24 22:26:55.476826 2017] [wsgi:error] [pid 2665] [remote 10.5.6.196:48804] Traceback (most recent call last):
[Tue Oct 24 22:26:55.476843 2017] [wsgi:error] [pid 2665] [remote 10.5.6.196:48804]   File "/var/www/html/portal/test2/wsgi.py", line 1
2, in <module>
[Tue Oct 24 22:26:55.476846 2017] [wsgi:error] [pid 2665] [remote 10.5.6.196:48804]     from django.core.wsgi import get_wsgi_applicati
on
[Tue Oct 24 22:26:55.476859 2017] [wsgi:error] [pid 2665] [remote 10.5.6.196:48804] ImportError: No module named 'django'

Apache virtualhost

 

<VirtualHost *:80>
    #My site Name
    ServerName portal.mysist.com

#    DocumentRoot  /var/www/portal

    #Demon process for multiple virtual hosts
    WSGIDaemonProcess portal threads=5 python-home=/var/www/html/portal/env python-path=/var/www/html/portal

    #Pointing wsgi script to config file
    WSGIScriptAlias / /var/www/html/portal/test2/wsgi.py
    WSGIProcessGroup portal

    #Your static files location
    Alias /static /var/www/html/portal/static/
    <Directory /var/www/html/portal/static>
        Require all granted
    </Directory>
    <Location "/media">
        SetHandler None
    </Location>
    <LocationMatch "\.(jpg|gif|png|js|css)$">
        SetHandler None
    </LocationMatch>

    <Directory /var/www/html/portal/test2>
        <Files wsgi.py>
#            WSGIProcessGroup portal
#            WSGIApplicationGroup %{GLOBAL}
            Require all granted
        </Files>
    </Directory>
</VirtualHost>

0

请先登录再写评论。