WebFaction
Community site: login faq

Hi!

I've been trying to deploy a Django project using Webfaction when I found this problem: custom apps do not register properly on django's admin site.

The funny thing is that:

  • All the models seem to be correctly registered as tables in the database.
  • I started a custom app serving Django's development server and it works fine, all the apps are there.

My settings.py:

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
 'django.contrib.admindocs',
 'lomas',
 'dummy',

)

My urls.py

  [...]
    from django.contrib import admin
    admin.autodiscover()
    urlpatterns = patterns('',
          url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
           [...]
          url(r'^admin/', include(admin.site.urls)),
    )

admin.py under lomas application: (just left a single model for testing)

from models import Complemento
from django.contrib import admin
admin.site.register(Complemento)

Any idea guys? :(

Thanks a lot for your help

asked 26 Jul '11, 06:53

Miguel G Biedma
111
accept rate: 0%


To register a model into the Admin you have to create admin.py module like described in https://docs.djangoproject.com/en/dev/ref/contrib/admin/#modeladmin-objects

permanent link

answered 26 Jul '11, 07:32

armonge
1
accept rate: 0%

I already did that (last piece of code in my post), thanks anyway ;)

(26 Jul '11, 10:46) Miguel G Biedma

You need to add your application's parent directory to the Python search path.

For example, if 'lomas' is located at /home/username/webapps/django/myproject/lomas then /home/username/webapps/django/myproject needs to be on the search path.

Instructions for setting your search path are available here:

Restart your Apache after making changes to your search path.

Hope that helps!

permanent link

answered 26 Jul '11, 11:39

seanf
12.1k21636
accept rate: 37%

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:

×900
×57
×53
×30

question asked: 26 Jul '11, 06:53

question was seen: 8,250 times

last updated: 26 Jul '11, 11:39

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 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