zoukankan      html  css  js  c++  java
  • 【问】django中视图转换

    mysite.url.py

    urlpatterns = patterns('mysite.video.views',
        #(r'^static/(?P<path>.*)$', 'django.views.static.serve',
        #{'document_root': settings.MEDIA_ROOT}),
        # Example:
        (r'^$', 'index'),
        # (r'^mysite/', include('mysite.foo.urls')),
        url(r'^video/', include('mysite.video.urls')),

        # Uncomment the admin/doc line below to enable admin documentation:
        # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

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

    mysite.video.url.py

    urlpatterns = patterns('',
        (r'^static/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.MEDIA_ROOT}),
    #    (r'^js/(?P<path>.*)$', 'django.views.static.serve',
    #    {'document_root': "/var/www/mysite/static/js"}),
    #    (r'^image/(?P<path>.*)$', 'django.views.static.serve',
    #    {'document_root': "/var/www/mysite/static/image"}),

        url(r'^$', index, name="index"),
        url(r'^login/', login, name="login"),
        url(r'^register', register, name="register"),
        url(r'^logout', logout, name="logout"),
        url(r'^setting/', setting, name="setting"),
        url(r'^setserver/', setserver, name="setserver"),
        url(r'^setcamera/', setcamera, name="setcamera"),
        url(r'^history/', history, name="history"),
        url(r'^live/', live, name="live"),
        url(r'^replay/', replay, name="replay"),
        url(r'^config/', config, name="config"),
    )

    视图中HttpResponseRedirect("live")或者超链接时,产生的url是http://localhost/mysite/video/live/并且页面显示不全

    视图中HttpResponseRedirect("/video/live")或者超链接也加/video前缀时,产生的url是http://localhost/video/live/并且页面显示全

    why?

  • 相关阅读:
    URL传递中文:Server.UrlEncode与Server.UrlDecode
    面向对象的封装性和多态性
    C#虚基类继承与接口的区别
    C# String与string的区别
    C# 索引器的使用
    ASP.NET 页面之间传递值的几种方式
    SQL Server中的游标CURSOR
    OpenLayers中的图层(转载)
    OpenLayers介绍和第一个例子(转载)
    SQL笔记-第七章,表连接
  • 原文地址:https://www.cnblogs.com/lidan/p/2485633.html
Copyright © 2011-2022 走看看