Wednesday, February 10, 2016

Re: how to deploy python/django application in debian/apache?

Hi James, thank you for so detailed answer in general about this problematic.

1) I am agreed with you that "root" folder is not the best place for my application. I thought if I try to chose another location for python app, paths in app will be different and it will not work. but I will try it later when I use my computer, as you said (new env and new location) and I will see what will happen. I will see also how to make Apache just to read and not to write in that folder.

2) iRedMail had redirection in apache from mijaw.com to mijaw.com/mail but I deleted that redirection and I have now clear apache default welcome page when I visit mijaw.com it means I must type mijaw.com/mail to visit iRedMail/roundcube. although https://mijaw.com and https://mijaw.com/mail are using the same ssl certificate from iRedMail. so, mijaw.com is clear apache welcome page & that's the place for python application, when visitors type https://mijaw.com they should get/visit my python app.

3) about single site: possibly you speak about single python site? but beside python can I have other sites as subdomains?
in this moment, I have VPS with one IP address and 2 domains on the same IP.
mijaw.com has one subdomain, html/css website, but it is subdomain like library.mijaw.com, mijaw.com is free for python application, another domain has several subdomains (flash, wordpress and 2 html/css websites).
so, I think there should be no problem to connect python app with this domain mijaw.com because it is default apache welcome page, I should be able to connect it with my python app. am I wrong?

4) this is exactly what I can't do, the paths are nightmare for me, I cannot connect python with apache: https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/modwsgi/
look this, I will never succeed to implement this general path into my particular case:
WSGIPythonPath /path/to/mysite.com:/path/to/your/venv/lib/python3.X/site-packages
I suppose I should chose that apache/wsgi option because I use virtualenv.

5) well, in the case it will not work in apache because of iredmail and other sites, can I install parallel nginx with apache and connect mijaw.com with nginx? problem is that I never used nginx than only apache, but I could try it, if it is necessary. than apache and iredmail would use mijaw.com/mail and nginx would use mijaw.com i.e. python app.

but in general, I would like to try first in apache, so, I would need help to implement this below in my particular case, I wrote in my first post my application paths:
WSGIPythonPath /path/to/mysite.com:/path/to/your/venv/lib/python3.X/site-packages

if somebody solve me this problem, I will move app from root folder in SRV or similar and change it in this path.

this is also killing me, I suppose it should be written in apache conf file "mijaw-ssl.conf":
WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py
WSGIPythonPath /path/to/mysite.com
Alias /robots.txt /path/to/mysite.com/static/robots.txt
Alias /favicon.ico /path/to/mysite.com/static/favicon.ico
Alias /media/ /path/to/mysite.com/media/
Alias /static/ /path/to/mysite.com/static/
<Directory /path/to/mysite.com/mysite>



6) of course, if I can use other port for https for django, it is good. just I don't know where are this https and port settings in my python app: https://docs.djangoproject.com/en/1.9/topics/security/#ssl-https
I will try to find later this string: SECURE_SSL_REDIRECT to True.
btw, I don't mind for search rankings :)

thank you for your answer. I will use later my computer and relocate app, try to find string and all the rest.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1ba75750-c424-473e-8ea1-62f556da5aef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment