Archive

Posts Tagged ‘webserver’

Deploying Django in Apache using mod_wsgi

June 27th, 2009

Deploying Django in Apache using mod_wsgi is the most recommended one when compared to using mod_python. Deploying Django in apache is not very difficult, its simple with quite simple steps. Here i have created a helloworld project and explained how to deploy it in apache. You must install mod_wsgi apache module before trying this.

Step 1: Create an directory named apache in your project directory. And add two files one for conf and another a wsgi application in it.

$mkdir apache

$cd apache

$touch apache_django_wsgi.conf

$touch dj_hello.wsgi

Step 2: Open the apache_django_wsgi.conf file with a text editor(gedit)and add the following contents

WSGIScriptAlias /dj “/path/to/us/project/folder/helloworld/apache/dj_hello.wsgi”

<Directory “/path/to/ur/project/folder/helloworld/apache”>

Allow from all

</Directory>

Here, helloworld is the name of the project

Step 3: Open the dj_hello.wsgi with a text editor(gedit) and add the following contents

import os, sys

#Calculate the path based on the location of the WSGI script.

apache_configuration= os.path.dirname(__file__)

project = os.path.dirname(apache_configuration)

workspace = os.path.dirname(project)

sys.path.append(workspace)

#Add the path to 3rd party django application and to django itself.

sys.path.append(‘/usr/lib/python2.5/site-packages/django/’)

os.environ['DJANGO_SETTINGS_MODULE'] = ‘helloworld.settings’

# project settings file

import django.core.handlers.wsgi

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


Step 4: Put an entry in your apache configuration fine (httpd.conf or apache2.conf depending upon the destro you are using)

Include “/path/to/ur/project/folder/helloworld/apache/apache_django_wsgi.conf”

helloworld, is the name of the django project that i am deploying in django. After doing all the steps don’t forget to restart the apache service for the changes to take effect.

Linux, Python, django , , , ,

Can the Outside world access my webserver Via Adsl DHCH line(Bsnl Broad band)?

June 25th, 2008

I wanted to allow all those who use internet to access the webpage hosted in my local webserver, when i am in a adsl dhcp broadband line. That is, by giving the IP address that is temporarily assigned to me, the user in the other end in internet should access my webpage . I wanted to know whether this works atleast for the few mins the IP address assigned to me.

I made a try, using ifconfig i found the system IP address. It said 192.168.1.33. And for editting the router setting, I used 192.168.1.1. so i found these Ip addresses are dummy, used just to establish a lan between the system and the router or modem.

Using www.whatsmyipaddress.com i found the real temporary dhcp ip assigned to me in the internet was something else. like ww.xxx.yy.zz. I gave the Ip address to my friend who was online and enabled my webserver service and i expected that my friend should get the page that was hosted with in my webserver. But my expectation went wrong. He got my router settings page requesting for username and password. I confirmed that it was my router settings page that i eddited sitting in my home. . .

Somebody could edit my router settings knowing my dhcp ip and my username and password. The same came when i gave the ww.xxx.yy.zz ip address in a browser of mine…. Still trying whether i could farward the request from my router to my system. Whether it is possible????

If some body could help comment me. . . .

May be my assemtion may be wrong in between correct me if i was wrong…..

During this try i Came across the word Dynamic DNS. Will tell you in details in my next post.

Internet , ,