apache2 django 1.8 wsgy.py无法找到我的项目

时间:2016-04-27 15:38:31

标签: django apache wsgi python-3.5 django-1.8

我正面临着将项目投入生产2天的问题。 我的项目名为'rfaapp',当我尝试访问页面时出现此apache错误:Importerror没有名为rfaapp的模块。

这是我的apache 2 000-default.conf

object result = cmd1.ExecuteScalar();
if(result != null)
{
     int conversionvalue = Convert.ToInt32(result);
     .....

}

我的wsgi.py

 <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
        Alias /static /home/adminrfaapp/rfaapp/static
        <Directory /home/adminrfaapp/rfaapp/static>
                Require all granted
        </Directory>

        <Directory /home/adminrfaapp/rfaapp/rfaapp>
                <Files wsgi.py>
                        Require all granted
                </Files>
        </Directory>
        #WSGIDaemonProcess rfa python-path=/home/adminrfaapp/.local/lib/python3.5

        WSGIDaemonProcess rfaapp python-path=/home/adminrfaapp/rfaapp/rfaapp:/home/adminrfaapp/.local/lib/python3.5
        WSGIProcessGroup rfaapp
        WSGIScriptAlias / /home/adminrfaapp/rfaapp/rfaapp/wsgi.py

</VirtualHost>

有人有想法吗?

1 个答案:

答案 0 :(得分:0)

一些想法:

1 /确保您在rfaapp文件夹中有__init__.py文件。

2 /在您的wsgi.py文件中,您忘记了在主路径中的前置/。

3 /在你的wsgi.py文件中,你可能想把它放在第一个位置,而不是附加你的rfaapp路径:

jar