开发者

How can i use admin application in my django framework without specifying '^admin/' keyword in url.py

I have made an application in djnago and using pre made admin application of django with that.I have the following urlpatterns in my url.py file and its working fine.

when i use http://ipaddress/admin the admin screen comes up and i can log in that ,same i can access others url's like http://ipaddress/admin/anything. But i dont want user to show that 开发者_开发问答admin keyword in my url,i just want when i request http://ipaddress then my login page appears and same for other pages without showing that admin part in weburl.How can i do that?

urlpatterns = patterns('',(r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
                       (r'^submit/$',views.get_xml),

                   # Uncomment the next line to enable the admin:
                   (r'^admin/', include(admin.site.urls)),
)


If you want the admin accessible from http://ipaddress, change your admin url to

(r'^', include(admin.site.urls)),

Copy and paste this:

urlpatterns = patterns('',
    (r'^', include(admin.site.urls)),
    (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
    (r'^submit/$',views.get_xml),(r'^add_question/$',views.add_question),
    (r'^update_difficulty/$',views.update_difficulty),
    (r'^delete_question/$',views.delete_question),
    (r'^update_question/$',views.update_question),
    (r'^update_mcq_question/$',views.update_mcq_question),
    (r'^update_marks/$',views.update_marks),
    (r'^wysiwyg_post/$',views.wysiwyg_post), 
)

note that the other example posted won't work:

(r'^$', include(admin.site.urls)) 

As it would only match the admin index.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜