mardi 12 août 2014

python - django déploiement d'apache pour plusieurs ports listinening - Stack Overflow


I am trying to deploy a Django website on apache. I did this.


tracking.wsgi


import os,sys
sys.path.append('/home/jarvis/django-tracking/tracking')
sys.path.append('/home/jarvis/django-tracking/tracking/tracking')

os.environ['DJANGO_SETTINGS_MODULE'] = 'tracking.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

and


/etc/apache2/http.conf


<VirtualHost *:80>

ServerName localhost
ServerAlias daifotis.dyndns.org
ServerAdmin webmaster@daifotis.com

DocumentRoot /home/jarvis/code/

Alias /media /home/jarvis/django-tracking/tracking/tracking/static
Alias /static /home/jarvis/django-tracking/tracking/tracking/static
#AliasMatch ^/([^/]*\.css) /home/jarvis/django-tracking/tracking/tracking/static/$1

<Directory /home/jarvis/django-tracking/tracking/tracking/static>
Order allow,deny
Allow from all
</Directory>

<Directory /home/jarvis/django-tracking/tracking/tracking/>
Order allow,deny
Allow from all
</Directory>

<Directory /home/jarvis/django-tracking/tracking>
Order allow,deny
Allow from all
</Directory>



WSGIScriptAlias / /home/jarvis/tracking.wsgi

<Directory /home/jarvis/django-tracking/tracking>
Order allow,deny
Allow from all
</Directory>

</VirtualHost>

Now whenever I type localhost and if the apache is running the site will display. so far so good.


My question are as follows:

1. In Django have a static_root also and we do a collectstatic, I still havent used that. What is the use of that over this ? How can I use that ?

2. I want to make apache listen to a port say 8888 and keep listening for I will send data at regular intervals on that port. How can I do that ?

3. While using Django runserver I was able to see what was happening with the help of print statements in the terminal here How can I do that for I want to see who and what kind of data is coming on the port 8888.

Thanks.





  1. You are using static_root: you have correctly set up Apache to serve from /static and /media, that's all you need.


  2. That's not a job for Apache. You'll need a standalone script that listens on a socket.


  3. Use the logging module to write to Apache's logs.




I am trying to deploy a Django website on apache. I did this.


tracking.wsgi


import os,sys
sys.path.append('/home/jarvis/django-tracking/tracking')
sys.path.append('/home/jarvis/django-tracking/tracking/tracking')

os.environ['DJANGO_SETTINGS_MODULE'] = 'tracking.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

and


/etc/apache2/http.conf


<VirtualHost *:80>

ServerName localhost
ServerAlias daifotis.dyndns.org
ServerAdmin webmaster@daifotis.com

DocumentRoot /home/jarvis/code/

Alias /media /home/jarvis/django-tracking/tracking/tracking/static
Alias /static /home/jarvis/django-tracking/tracking/tracking/static
#AliasMatch ^/([^/]*\.css) /home/jarvis/django-tracking/tracking/tracking/static/$1

<Directory /home/jarvis/django-tracking/tracking/tracking/static>
Order allow,deny
Allow from all
</Directory>

<Directory /home/jarvis/django-tracking/tracking/tracking/>
Order allow,deny
Allow from all
</Directory>

<Directory /home/jarvis/django-tracking/tracking>
Order allow,deny
Allow from all
</Directory>



WSGIScriptAlias / /home/jarvis/tracking.wsgi

<Directory /home/jarvis/django-tracking/tracking>
Order allow,deny
Allow from all
</Directory>

</VirtualHost>

Now whenever I type localhost and if the apache is running the site will display. so far so good.


My question are as follows:

1. In Django have a static_root also and we do a collectstatic, I still havent used that. What is the use of that over this ? How can I use that ?

2. I want to make apache listen to a port say 8888 and keep listening for I will send data at regular intervals on that port. How can I do that ?

3. While using Django runserver I was able to see what was happening with the help of print statements in the terminal here How can I do that for I want to see who and what kind of data is coming on the port 8888.

Thanks.




  1. You are using static_root: you have correctly set up Apache to serve from /static and /media, that's all you need.


  2. That's not a job for Apache. You'll need a standalone script that listens on a socket.


  3. Use the logging module to write to Apache's logs.



0 commentaires:

Enregistrer un commentaire