日食で DJango プロジェクトを作成しました。後で新しいアプリケーションを追加しました ( R-CLick Project folder ---> DJANGO ---> Create application (manage.py startapp)
)
私はそれに名前を付けますSuper
。
次に、別の新しいアプリケーションを (上記と同じ手順を使用して) 作成し、名前を付けましたHuman
。
現在、私のプロジェクトでは、2 つのアプリケーションが作成されています (Eclipse では 2 つのパッケージとして表示されます)。
admin.py
パッケージ内にというファイルがありますSuper
。
コードは次のとおりです。
from django.contrib import admin
from Super.models import People
from Human.models import NormalHuman
admin.site.register(People)
admin.site.register(NormalHuman)
Settings.py
ファイルに2つの新しいアプリケーションを登録しました。
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'Super',
'Human',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
urls.py
ファイルにも変更を加えました。
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from Human.models import NormalHuman
admin.autodiscover()
urlpatterns = patterns('',
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
url(r'^normal/', NormalHuman),
)
解決したい問題:
1.) サーバーを再起動した後、URL に移動しようとすると127.0.0.1:9095/normal
、404 になります。
2.)NormalHuman
管理ページに追加する必要があるため、そのコンテンツにアクセスできます。