Bitnami Django Stack服务器无法识别新项目

时间:2015-11-29 13:54:42

标签: python django apache bitnami

我遵循了这些步骤,

https://wiki.bitnami.com/Infrastructure_Stacks/BitNami_Django_Stack#How_to_create_a_new_Django_project.3f

我成功创建了一个新项目。但是当我去localhost / SevenERP / product_app时,它会抛出这个错误:

Not Found

The requested URL /SevenERP was not found on this server.

问题是什么?这是我的文件夹结构:

Folder Structure

这些是我的.conf文件:

的httpd-app.conf

<Directory "C:/Users/JuanPablo/Bitnami Django Stack projects/SevenERP/SevenERP">
    Options +MultiViews
    AllowOverride All
    <IfVersion < 2.3 >
        Order allow,deny
        Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
        Require all granted
    </IfVersion>


WSGIApplicationGroup %{GLOBAL}
    <IfVersion < 2.3 >
        Order allow,deny
        Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
        Require all granted
    </IfVersion>

</Directory>

Alias /static "C:\Bitnami\djangostack-1.8.7-0/apps/django/lib/python2.7/site-packages/django/contrib/admin/static"
WSGIScriptAlias /SevenERP 'C:/Users/JuanPablo/Bitnami Django Stack projects/SevenERP/SevenERP/wsgi.py'

的httpd-prefix.conf

# Include file
Include "C:/Users/JuanPablo/Bitnami Django Stack projects/SevenERP/conf/httpd-app.conf"

的httpd-vhosts.conf

<VirtualHost *:80>
    ServerName djangostack.example.com
    ServerAlias www.djangostack.example.com
    DocumentRoot "C:/Users/JuanPablo/Bitnami Django Stack projects/SevenERP/SevenERP"

    Include "C:/Users/JuanPablo/Bitnami Django Stack projects/SevenERP/conf/httpd-app.conf"
</VirtualHost>

<VirtualHost *:443>
    ServerName djangostack.example.com
    ServerAlias www.djangostack.example.com
    DocumentRoot "C:/Users/JuanPablo/Bitnami Django Stack projects/SevenERP/SevenERP"
    SSLEngine on
    SSLCertificateFile "C:/Users/JuanPablo/Bitnami Django Stack projects/SevenERP/conf/certs/server.crt"
    SSLCertificateKeyFile "C:/Users/JuanPablo/Bitnami Django Stack projects/SevenERP/conf/certs/server.key"

    Include "C:/Users/JuanPablo/Bitnami Django Stack projects/SevenERP/conf/httpd-app.conf"
</VirtualHost>

因为从bitnami安装程序安装的默认Project工作正常:

Default Project installed by bitnami installer

请帮忙。

3 个答案:

答案 0 :(得分:2)

您必须在apache服务器中修改2个文件

/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf
你会看到像这样的东西:

# Bitnami applications installed in a prefix URL

Include "/opt/bitnami/apps/django/django_projects/Project/conf/httpd-prefix.conf"

您必须包含您在项目中创建的httpd-prefix.conf的路径。

Include "/opt/bitnami/apps/django/django_projects/YourProject/conf/httpd-prefix.conf"

更改您的项目以获取您的项目名称,您必须删除&#34; include&#34;指向Project,否则你必须配置:

/opt/bitnami/apps/django/django_projects/Project/conf/bitnami-apps-vhosts.conf

适用于多个网站。

最终文件如下所示:

# Bitnami applications installed in a prefix URL

Include "/opt/bitnami/apps/django/django_projects/Host/conf/httpd-prefix.conf"

在文件中:

/opt/bitnami/apps/django/django_projects/YourProject/conf/httpd-app.conf

添加:

Alias /static "/opt/bitnami/apps/django/lib/python2.7/site-packages/Django-1.8.7-py2.7.egg/django/contrib/admin/static"
WSGIScriptAlias / '/opt/bitnami/apps/django/django_projects/YourProject/YourProject/wsgi.py'

然后

如果您以root用户身份安装BitNami Django堆栈,或者如果您使用的是虚拟机或云映像,请使用sudo安装要求并启动服务器:

$ cd mysite
$ sudo pip install -r requirements.txt

* /在settings.py * / https://wiki.bitnami.com/Components/Django

中配置您的数据库
$ python manage.py syncdb
$ sudo /opt/bitnami/ctlscript.sh restart apache

更多信息:

https://www.youtube.com/watch?v=6kknDPGYr3I

https://community.bitnami.com/t/installing-pinax-on-djangostack-virtual-machine/3286/7

答案 1 :(得分:1)

根据您分享的Bitnami Django Link,

settings.py中没有将应用名称包含在 INSTALLED_APP 中的步骤。

您必须注册应用名称,否则将不会使用您已配置为控制器的网址。

我希望这会为你解决。

Solution

答案 2 :(得分:1)

Bitnami开发者在这里。

该问题与python路径有关。 对于UNIX,您应该在开头添加这些行 httpd-app.conf档案:

WSGIDaemonProcess wsgi-djangostack processes=2 threads=15 display-name=%{GROUP} python-path=/Path-to-the-project/

然后,重启Apache。

在您的情况下(Windows),您应该添加此行添加installdir\apache2\conf\httpd.conf的结尾:

WSGIPythonPath "C:/Users/JuanPablo/Bitnami Django Stack projects/SevenERP" 并重新启动Apache。

我希望它有所帮助