logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache2.4 context path for virtual host with Django&Angu
Author
metaing



Joined: 20 Jul 2016
Posts: 2
Location: Italy, Rome

PostPosted: Sun 31 Jul '16 18:54    Post subject: Apache2.4 context path for virtual host with Django&Angu Reply with quote

I had the following working Django configuration:

Code:
WSGIScriptAlias / /MyDjangoProjectFolder/MyDjangoProject/wsgi.py
    WSGIPythonPath /MyDjangoProjectFolder
   
    <Directory /MyDjangoProjectFolder/MyDjangoProject>
       <Files wsgi.py>
            Order deny,allow
           Require all granted
       </Files>
    </Directory>
   
    Alias /base_context_path/static/ /MyDjangoProjectFolder/static/
   
    <Directory /MyDjangoProjectFolder/static>
        Require all granted
    </Directory>


Django responds on `<ip>/base_context_path/rest` (for rest APIs invoked by the frontend) and `<ip>/base_context_path/admin` (for administration, which uses base_context_path/static).
So everything needed by Django is on `<ip>/base_context_path/*`.

Now I need to deploy a website developed in Angular on this same Apache2, so I am trying to understand how to make it work. I have a domain name for this website (mydomainname.org), but not a dedicated one for the django application. When visiting my domain name, I would expect my website to appear.

This is my attempt for my website:

Code:
<VirtualHost *:80>
        ServerName mydomainname.org
        DocumentRoot /MyWebSiteFolder
        DirectoryIndex index.html
     <Directory "/MyWebSiteFolder">
    # redirect rules for managing AngularJS
      </Directory>
    </VirtualHost>


It does not work (403).

For my Django application, this is the virtual host I created, which does not work as well (403):

Code:
<VirtualHost *:80>
    ServerName mydomainname
    Alias /base_context_path/static/ /MyDjangoProjectFolder/static
   
    WSGIScriptAlias / /MyDjangoProjectFolder/MyDjangoProject/wsgi.py
   
    WSGIDaemonProcess MyDjangoProject python-path=/MyDjangoProjectFolder:/usr/local/lib/python2.7/site-packages
    WSGIProcessGroup MyDjangoProject
   
   
    <Directory /MyDjangoProjectFolder/static>
            Options -Indexes
        Require all granted
    </Directory>


So I am kind of stuck.
Back to top


Reply to topic   Topic: Apache2.4 context path for virtual host with Django&Angu View previous topic :: View next topic
Post new topic   Forum Index -> Apache