Просмотр исходного кода

首页后盾返回参数冲突解决

yf_zd 5 лет назад
Родитель
Сommit
8df2815b98
3 измененных файлов с 21 добавлено и 19 удалено
  1. 16 15
      apps/Equipment/urls.py
  2. 1 1
      apps/Home/views.py
  3. 4 3
      second_pro/urls.py

+ 16 - 15
apps/Equipment/urls.py

@@ -218,23 +218,24 @@ urlpatterns = [
     url(r'^test_photo$', Test_Photo.as_view(), name='test_photo'),
 
     # 配置文件夹路由:
-    url(r'^hotel_photo/(?P<path>.*)', serve, {'document_root': 'G:\YFWLW\second\hotel_photo'}), #本地
-    url(r'^hotel_photos/(?P<path>.*)', serve, {'document_root': 'G:\YFWLW\second\hotel_photos'}), #本地
-    url(r'^hvideos/(?P<path>.*)', serve, {'document_root': 'G:\YFWLW\second\hvideos'}), #本地
-    url(r'^hnews_photo/(?P<path>.*)', serve, {'document_root': 'G:\YFWLW\second\hnews_photo'}), #本地
-    url(r'^hvideo_photo/(?P<path>.*)', serve, {'document_root': 'G:\YFWLW\second\hvideo_photo'}), #本地
-    url(r'^product_photo/(?P<path>.*)', serve, {'document_root': 'G:\YFWLW\second\product_photo'}), #本地
-    url(r'^garden_photo/(?P<path>.*)', serve, {'document_root': 'G:\YFWLW\second\garden_photo'}), #本地
-    url(r'^guser_photo/(?P<path>.*)', serve, {'document_root': 'G:\YFWLW\second\guser_photo'}), #本地
+    # url(r'^hotel_photo/(?P<path>.*)', serve, {'document_root': 'G:\YFWLW\second\hotel_photo'}), #本地
+    # url(r'^hotel_photos/(?P<path>.*)', serve, {'document_root': 'G:\YFWLW\second\hotel_photos'}), #本地
+    # url(r'^hvideos/(?P<path>.*)', serve, {'document_root': 'G:\YFWLW\second\hvideos'}), #本地
+    # url(r'^hnews_photo/(?P<path>.*)', serve, {'document_root': 'G:\YFWLW\second\hnews_photo'}), #本地
+    # url(r'^hvideo_photo/(?P<path>.*)', serve, {'document_root': 'G:\YFWLW\second\hvideo_photo'}), #本地
+    # url(r'^product_photo/(?P<path>.*)', serve, {'document_root': 'G:\YFWLW\second\product_photo'}), #本地
+    # url(r'^garden_photo/(?P<path>.*)', serve, {'document_root': 'G:\YFWLW\second\garden_photo'}), #本地
+    # url(r'^guser_photo/(?P<path>.*)', serve, {'document_root': 'G:\YFWLW\second\guser_photo'}), #本地
     
 
-    # url(r'^hotel_photo/(?P<path>.*)', serve, {'document_root': '/home/web/second/second/hotel_photo'}), #本地
-    # url(r'^hotel_photos/(?P<path>.*)', serve, {'document_root': '/home/web/second/second/hotel_photos'}), #本地
-    # url(r'^hvideos/(?P<path>.*)', serve, {'document_root': '/home/web/second/second/hvideos'}), #本地
-    # url(r'^hnews_photo/(?P<path>.*)', serve, {'document_root': '/home/web/second/second/hnews_photo'}), #本地
-    # url(r'^hvideo_photo/(?P<path>.*)', serve, {'document_root': '/home/web/second/second/hvideo_photo'}), #本地
-    # url(r'^product_photo/(?P<path>.*)', serve, {'document_root': '/home/web/second/second/product_photo'}), #本地
-    # url(r'^garden_photo/(?P<path>.*)', serve, {'document_root': '/home/web/second/second/garden_photo'}), #本地
+    url(r'^hotel_photo/(?P<path>.*)', serve, {'document_root': '/home/web/second/second/hotel_photo'}), #本地
+    url(r'^hotel_photos/(?P<path>.*)', serve, {'document_root': '/home/web/second/second/hotel_photos'}), #本地
+    url(r'^hvideos/(?P<path>.*)', serve, {'document_root': '/home/web/second/second/hvideos'}), #本地
+    url(r'^hnews_photo/(?P<path>.*)', serve, {'document_root': '/home/web/second/second/hnews_photo'}), #本地
+    url(r'^hvideo_photo/(?P<path>.*)', serve, {'document_root': '/home/web/second/second/hvideo_photo'}), #本地
+    url(r'^product_photo/(?P<path>.*)', serve, {'document_root': '/home/web/second/second/product_photo'}), #本地
+    url(r'^garden_photo/(?P<path>.*)', serve, {'document_root': '/home/web/second/second/garden_photo'}), #本地
+    url(r'^guser_photo/(?P<path>.*)', serve, {'document_root': '/home/web/second/second/garden_photo'}), #本地
 
 
 ]

+ 1 - 1
apps/Home/views.py

@@ -130,7 +130,7 @@ class Home(View):
         product = Product.objects.all()[0:8]
         pick = Pick_Pub.objects.all()[0:6]
         farm = FarmList.objects.all()[0:6]
-        user = Hotel_Info.objects.all()[0:5]
+        hotel = Hotel_Info.objects.all()[0:5]
         if request.user.is_authenticated():
             user_name = request.user.username
             curr_user = MyUser.objects.get(username=user_name)

+ 4 - 3
second_pro/urls.py

@@ -14,11 +14,12 @@ Including another URLconf
     2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
 """
 from django.conf.urls import url, include
-from django.conf import settings
-from django.conf.urls.static import static
 from django.contrib import admin
+from second_pro import settings
+from django.views import static
 
 urlpatterns = [
+    url(r'^static/(?P<path>.*)$', static.serve,{'document_root': settings.STATIC_ROOT}, name='static'),
     url(r'^admin/', admin.site.urls),
 
     url(r'', include('apps.AppInfo.urls')),
@@ -26,5 +27,5 @@ urlpatterns = [
     url(r'', include('apps.Equipment.urls')),
     url(r'', include('apps.Home.urls')),
     url(r'^ckeditor/', include('ckeditor_uploader.urls'))
-] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+]