Jump to content

Why Does My Directory Come Up On A Browser?


Recommended Posts

  • 3 weeks later...

here it is:

 

pydevstore.co.cc

 

So, the broblem is how to make the server run my python/django app.

 

For more information, here is my /public_html/expert2/dispatch.wsgi file:

 

 

import os, sys

 

sys.path.append("/home1/medreda/public_html/expert2")

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

os.environ['PYTHON_EGG_CACHE'] = '/home1/medreda/.python_egg_cache'

 

import django.core.handlers.wsgi

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

 

and my /public_html/expert2/.htaccess file :

 

 

RewriteEngine On

RewriteBase /

RewriteRule ^(dispatch\.wsgi/.*)$ - [L]

RewriteRule ^(.*)$ medreda/dispatch.wsgi/$1 [QSA,PT,L]

 

and my /public_html/.htaccess file:

 

 

# -FrontPage-

 

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

 

<Limit GET POST>

order deny,allow

deny from all

allow from all

</Limit>

<Limit PUT DELETE>

order deny,allow

deny from all

</Limit>

AuthName pydevstore.co.cc

AuthUserFile /home1/medreda/public_html/_vti_pvt/service.pwd

AuthGroupFile /home1/medreda/public_html/_vti_pvt/service.grp

Options -Indexes

 

 

By the way, is it normal to have 2 .htaccess files as i have shown ?

Link to comment
Share on other sites

You originally posted because your files were showing in your index. You need to create an index file, either index.html, index.htm, index.php, etc.

 

You can have several .htaccess files on your site.

 

I have no idea what could be wrong with your python/django app.

Link to comment
Share on other sites

If you'll add this to your root .htaccess file, it will stop directory listing without creating an index file:

 

-Indexes

 

Unzip this django test on your site:

 

http://area51.heliohost.org/djangotest.zip

 

and then edit the dispatch.wsgi in two places to match your site's path. Also make sure the path to PYTHON_EGG_CACHE is correct and be sure to chmod it to 777.

 

Link to comment
Share on other sites

Thanks for assistance

your files doesn't work for me.

 

But, i've some half solution:

i just used 2 htaccess, one in public_html folder with this code:

 

RewriteEngine On

RewriteBase /

RewriteRule ^(media/.*)$ - [L]

RewriteRule ^(admin_media/.*)$ - [L]

RewriteRule ^(dispatch\.wsgi/.*)$ - [L]

RewriteRule ^(.*)$ /dispatch.wsgi/$1 [QSA,PT,L]

 

and the other in my project folder:

 

RewriteEngine On

RewriteBase /

RewriteRule ^(media/.*)$ - [L]

RewriteRule ^(admin_media/.*)$ - [L]

RewriteRule ^(dispatch\.wsgi/.*)$ - [L]

RewriteRule ^(.*)$ expert2/dispatch.wsgi/$1 [QSA,PT,L]

 

and dispatch.wsgi file like this;

 

 

import os, sys

 

 

sys.path.append("/home1/medreda/public_html/expert2")

 

### EDIT LINE ABOVE TO YOUR SITE ###

 

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

os.environ['PYTHON_EGG_CACHE'] = '/home1/medreda/.python_egg_cache'

 

### YOU NEED TO CREATE THE DIRECTORY ABOVE ###

 

 

def application(environ, start_response):

"""Simplest possible application object"""

output = "Hello World from hosted WSGI"

status = '200 OK'

response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))]

start_response(status, response_headers)

return [output]

 

It gives me : Hello word in my browser with this URL pydevstore.co.cc

(for information it doesn't call any web app here).

 

But when i use this code for the wsgi file (given in the example):

 

import os, sys

 

 

sys.path.append("/home1/medreda/public_html/expert2")

 

### EDIT LINE ABOVE TO YOUR SITE ###

 

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

os.environ['PYTHON_EGG_CACHE'] = '/home1/medreda/.python_egg_cache'

 

### YOU NEED TO CREATE THE DIRECTORY ABOVE ###

 

 

import django.core.handlers.wsgi

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

 

it gives an error (when i call my django app)

 

So could you say what does it mean, please

Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...