Django Webpack Loader Apache2

问题描述 投票:0回答:1

我有一个带有webpackloader djangorest-react js的项目,在生产中一切正常,但是我每次都需要启动django服务器...我的目标是通过mod_wsgi用apache2运行django和我的react项目,我可以运行django项目,但react仍然无法访问...

这是apache2 for django的工作配置,可以正常工作。

        # 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 [email protected]
        DocumentRoot /var/www/html
        ServerName www.flexiwork.fr
        # 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/olivier/coworking/API/static
        <Directory /home/olivier/coworking/API/static>
         Require all granted
        </Directory>
        Alias /media /home/olivier/coworking/API/backend/media
        <Directory /home/olivier/coworking/API/backend/media>
         Require all granted
        </Directory>
        <Directory /home/olivier/coworking/API>
                <Files wsgi.py>
                  Require all granted
                </Files>
        </Directory>
        #LogLevel info
        #WSGIApplicationGroup %{GLOBAL}
        WSGIScriptAlias / /home/olivier/coworking/API/backend/wsgi.py process-group=coworking
        WSGIDaemonProcess coworking python-path=/home/olivier/coworking/API python-home=/home/olivier/coworking/API/env processes=5 threads=15
        WSGIProcessGroup coworking
</VirtualHost>

我认为我需要使用其他守护进程或代理,但是如果您有任何链接或提前告知您,我会有些迷茫。

reactjs linux apache django-rest-framework django-webpack-loader
1个回答
0
投票
构建后,我在Django的wsgi选择中加载了错误的设置文件,这不是apache2的问题,这是我的配置文件:
© www.soinside.com 2019 - 2024. All rights reserved.