> On 10 Jul 2018, at 10:40 am, Bob Bobsled <[email protected]> wrote: > > Hi, > That's an interesting approach. > > I tried with the django project in c:/wamp/www/mysite2, and the placed the > polls2 app inside the mysite2. > > I'm still getting the 404 error when trying > httpd://polls2.xxx.xxx.xx.xx.nip.io <httpd://polls2.xxx.xxx.xx.xx.nip.io> Can't help unless can see whether the 404 is from Apache or Django.
Have you tried setting DEBUG=True in Django settings temporarily to see if it is getting through to Django. > It initially asked me to add the url to settings.py, but still no joy. > > Not sure what I might be doing wrong. Any help appreciated. > > Regards, > Bob > > > //httpd.conf----------------- > > LoadFile > "c:/users/administrator/appdata/local/programs/python/python36-32/python36.dll" > LoadModule wsgi_module > "c:/users/administrator/appdata/local/programs/python/python36-32/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win32.pyd" > > WSGIPythonHome > "c:/users/administrator/appdata/local/programs/python/python36-32" > > WSGIScriptAlias / C:/wamp/www/mysite2/mysite2/wsgi.py > WSGIPythonPath C:/wamp/www/mysite2 > > <Directory "C:/wamp/www/mysite2/mysite2/"> > <Files wsgi.py> > Order deny,allow You don't need this Order directive in Apache 2.4, only Require all granted. > Require all granted > </Files> > </Directory> The WSGIScriptAlias and Directory block would usually be inside of the VirtualHost where for the application. > //httpd-vhosts.conf---------------------------------- > > <VirtualHost *:80> > ServerName localhost > ServerAlias localhost > DocumentRoot c:/wamp/www > <Directory "c:/wamp/www/"> > Options +Indexes +Includes +FollowSymLinks +MultiViews > AllowOverride All > #Require local > Require all granted > </Directory> > </VirtualHost> > > <VirtualHost *:80> > ServerName polls2.xxx.xxx.xx.xx.nip.io > <http://polls2.xxx.xxx.xx.xx.nip.io/> > ServerAlias polls2.xxx.xxx.xx.xx.nip.io > <http://polls2.xxx.xxx.xx.xx.nip.io/> > DocumentRoot c:/wamp/www You should not put your Django code under the DocumentRoot directory. > <Directory "C:/wamp/www/mysite2/"> > Options +Indexes +Includes +FollowSymLinks +MultiViews > AllowOverride All > Require all granted > </Directory> Replace this Directory blog with WSGIScriptAlias and Directory blog you had above. > </VirtualHost> > > On Sun, Jul 8, 2018 at 2:51 PM, Graham Dumpleton <[email protected] > <mailto:[email protected]>> wrote: > When using VirtualHost, and hosting multiple sites all on the same port, you > need to access the site through a proper hostname, not an IP address or > localhost. When you use localhost or an IP address it will always be handled > by the first VirtualHost as there is no hostname it can match against for the > VirtualHost ServerName directive. Using localhost or an IP for ServerName > doesn't do anything. > > The easiest thing to do if you don't have a unique hostname to use, is set up > up your separate VirtualHost for your Django application and add it last in > the file. When adding, specify ServerName inside of that VirtualHost as: > > ServerName django.A.B.C.D.nip.io <http://django.a.b.c.d.nip.io/> > > where A.B.C.D is the IP address of the host. > > You can then access the web site as: > > http://django.A.B.C.D.nip.io <http://django.a.b.c.d.nip.io/> > > The 'nip.io <http://nip.io/>' is a special domain name that implements a DNS > which will return the IP A.B.C.D for the hostname in that form. So the > request will go to your Apache and because you used hostname > 'django.A.B.C.D.nip.io <http://django.a.b.c.d.nip.io/>' in the URL, Apache > can match that properly against ServerName for that VirtualHost and direct > your request to the Django setup within that VirtualHost. > > Graham > > >> On 9 Jul 2018, at 10:42 am, [email protected] >> <mailto:[email protected]> wrote: >> >> Hi, >> >> >> >> I'm a novice and slowly working thru a production server problem. >> >> >> >> Trying to get django and mod_wsgi to play nicely with existing wamp sites on >> Win7 on a production server. Directions from django users group (google) >> seems to indicate I can do this by changing default port for mod_wsgi from >> 80 to something else which doesn't conflict with the existing non-django >> sites on wamp. >> >> >> >> I do not have a virtualenv setup at the moment, and am not using deamon >> mode. I'm basically just testing the plumbing, so to speak, to try to get >> this working first. >> >> >> >> I have several configurations of django project/app described below but I'd >> really prefer to keep it in c:/wamp/www along with all our other sites, but >> have the django site use a different port so everything will run without 404 >> error. >> >> >> >> Since I'm a novice at setting up django and mod_wsgi, I could use some help >> and direction with perhaps the virtual hosts conf file, if that's the way to >> go. >> >> How would I go about changing the mod_wsgi port from 80 to say :9090 for ex. >> for a django site in c:/wamp/www/mysite, for ex.? >> >> >> >> >> >> >> >> Wampserver 3.0.6 32bit, with apache2.4.23 >> >> --------------- >> >> PYTHON AND APACHE: >> >> >> >> Python 3.6.5 32bit, with Django 2.0.6 >> >> >> >> --------------- >> >> MOD_WSGI: >> >> >> >> Could not pip install mod_wsgi, and needed to download VisualStudio build >> tools and upgrade framework to 4.7.1. >> >> >> >> Downloaded mod_wsgi-4.5.24+ap24vc14-cp36-cp36m-win32.whl >> >> https://www.lfd.uci.edu/~gohlke/pythonlibs/ >> <https://www.lfd.uci.edu/~gohlke/pythonlibs/> >> to work with apache 2.4.23, VC++14, and python3.6 >> >> >> >> then did >> pip install >> C:\Users\Administrator\Downloads\mod_wsgi-4.5.24+ap24vc14-cp36-cp36m-win32.whl. >> Did not get mod_wsgi.so in apache modules folder, but did get a .pyd in: >> c:/users/administrator/appdata/local/programs/python/python36-32/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win32.pyd >> >> >> >> Could then run mod_wsgi-express. >> >> >> >> From cmd prompt in apache bin dir used >httpd -t -D DUMP_MODULES to show >> wsgi_module (shared) is present. >> >> ---------------- >> >> We have several small non-django websites running on wamp. >> >> Those projects are in c:/wamp/www/myproject for ex. and are accessed as >> localhost/myproject or myipxxx/myproject. >> >> >> >> Under wamp I have tried putting the django project in c:/wamp/apps, in >> c:/wamp/www, and just in c:/wamp too. They all work fine with apache and >> mod_wsgi. >> >> >> >> At least I get a sample "helloworld" message in the webpage when I access >> the django site as localhost/mydjangosite or myipxxx/mydjangosite. This is >> basically the simple tut01 or polls app kindof django project. >> >> >> >> But the django project, wherever I put it in wamp, buggers our other >> non-django websites. I get a message back from urls.py saying it's been >> thru all the urls listed and it cannot access our regular (non django sites) >> in c:/wamp/www when I try to access one as localhost/myproject or >> myipxxx/myproject from the browser. >> >> ----------------- >> >> I believe the apache virtual host file is this right now. Sorry doing this >> a bit patchwork. >> >> >> >> >> >> <VirtualHost *:80> >> >> ServerName localhost >> >> ServerAlias localhost >> >> DocumentRoot c:/wamp/www >> >> <Directory "c:/wamp/www/"> >> >> Options +Indexes +Includes +FollowSymLinks +MultiViews >> >> AllowOverride All >> >> #Require local >> >> Require all granted >> >> </Directory> >> >> </VirtualHost> >> >> >> >> <VirtualHost *:80> >> >> Alias /static c:/wamp/www-src/static >> >> <Directory c:/wamp/www-src/static> >> >> Require all granted >> >> </Directory> >> >> >> </VirtualHost> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "modwsgi" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] >> <mailto:[email protected]>. >> To post to this group, send email to [email protected] >> <mailto:[email protected]>. >> Visit this group at https://groups.google.com/group/modwsgi >> <https://groups.google.com/group/modwsgi>. >> For more options, visit https://groups.google.com/d/optout >> <https://groups.google.com/d/optout>. > > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at https://groups.google.com/group/modwsgi > <https://groups.google.com/group/modwsgi>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. > > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at https://groups.google.com/group/modwsgi > <https://groups.google.com/group/modwsgi>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/modwsgi. For more options, visit https://groups.google.com/d/optout.
