Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5049

Configure Apache for Django REST backend and React frontend on same domain

$
0
0

How to configure Apache for Django REST backend and React frontend on same domain

One domain (for solve crossdomain problems).

Urls:

example.com/
example.com/api/

where:

example.com/     - React-based frontend
example.com/api/ - Django-based REST backend

How implement it with Apache ?

I think some like a:

<VirtualHost *:80>
    ServerName ${DOMAIN}

    DocumentRoot ${SITE_FOLDER}

    CustomLog /var/log/apache2/${DOMAIN}_access.log common
    ErrorLog /var/log/apache2/${DOMAIN}_error.log

    WSGIDaemonProcess ${DOMAIN} user=${APACHE_USER} group=${APACHE_GROUP} python-path=${SITE_FOLDER}:${VENV_PACKAGES_PATH}
    WSGIProcessGroup ${DOMAIN}
    WSGIScriptAlias / ${SITE_FOLDER}/core/wsgi.py

    Alias /static/ ${SITE_FOLDER}/static/

    <Directory ${SITE_FOLDER}/static>
        Require all granted
    </Directory>

    <Directory ${SITE_FOLDER}/core>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>
</VirtualHost>

is the backend, it serve /api

...but, how to implement frontend ?


Viewing all articles
Browse latest Browse all 5049

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>