WebFaction
Community site: login faq

hi all -

I'm trying to set up a Django site according to the tutorial found here: http://docs.webfaction.com/software/django/getting-started.html

I'm able to set up part of the site - http://myapp.webfactional.com/media returns ok, but when my http://myapp.webfactional.com/media/admin/ gives me a 403 Forbidden (nginx) error.

I gave permissions to nginx (per this post: http://forum.webfaction.com/viewtopic.php?id=2264)

I can cd to my symlink, so I know that is valid.

in settings.py, I have ADMIN_MEDIA_PREFIX = 'http://myapp.webfactional.com/media/admin/'

my apps under domains/websites looks like this: app URL myapp / static_serve /media admin /media/admin

and Finally - the last line of the error file: 2011/07/11 12:03:47 [error] 10243#0: *1996566 directory index of "/home/myapp/webapps/admin/" is forbidden, client: 000.00.00.4, server: myapp.webfactional.com, request: "GET /media/admin/ HTTP/1.1", host: "myapp.webfactional.com"

TIA - Joe

asked 11 Jul '11, 12:32

jabs
1123
accept rate: 0%


Our Nginx configuration prohibits directory listings, so URLs like "http://myapp.webfactional.com/media/admin/" will always be 403.

You should still be able to access your media files, eg "http://myapp.webfactional.com/media/admin/css/base.css".

If you can't, then please open a support ticket and we'll have a closer look.

permanent link

answered 11 Jul '11, 13:06

seanf
12.2k42136
accept rate: 37%

edited 11 Jul '11, 13:07

Thanks for the quick reply Sean -

So...I'll just need to add the admin portion to my URLs.py file and not use it as static content. Is this correct, or is there another way to handle it (or better yet, what's the best way to handle it, since there is always another way to handle it)?

(11 Jul '11, 13:41) jabs

I'm not sure what you mean by "it".

If you're serving your admin media from a symlink app, then you're already doing it correctly.

(11 Jul '11, 14:33) seanf

Still figuring this out, so thanks for bearing with me...

I'm looking to access the django admin module, but having trouble doing it. When I go to myapp.webfaction.com/admin, I get an error:


DoesNotExist at /admin/

Site matching query does not exist.

Request Method: GET Request URL: http://myapp.webfactional.com/admin/ Django Version: 1.3 Exception Type: DoesNotExist Exception Value:

Site matching query does not exist.

Exception Location: /home/myapp/webapps/fb/lib/python2.7/django/db/models/query.py in get, line 349 Python Executable: /usr/local/bin/python Python Version: 2.7.1


my urls.py is:


from django.conf.urls.defaults import patterns, include, url

Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover()

urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), )


So, I guess I'm looking for some direction in figuring how to access this module. Should I investigate what looks like a django error or is there something else? Thanks again.

Joe

(11 Jul '11, 15:04) jabs

Did you restart your Apache after you configured your admin stuff?

(11 Jul '11, 15:13) seanf

yes - did it again and same error.

(11 Jul '11, 15:38) jabs

Found the problem. My django_sites table (mysql) was empty. I inserted the values and now the module works. Thanks for your help in this. Not sure if doing a back-end insert is the best idea, since I don't fully understand how that table relates to the app as a whole, but it solved this immediate crises. Besides, I'm not sure how to populate it any other way. So...problem solved for now.

permanent link

answered 12 Jul '11, 11:09

jabs
1123
accept rate: 0%

and Sean (et al) - if you recommend a better way to populate that table so it doesn't bite me later, any thoughts are appreciated. Thanks much.

(12 Jul '11, 11:11) jabs
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×30
×12
×6

question asked: 11 Jul '11, 12:32

question was seen: 10,729 times

last updated: 12 Jul '11, 11:11

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM