我写云面板写python/django。我的问题是,url.py不能访问下一个转发目录。我用apache。当转到下一页时,此页显示:
https://postimg.org/image/b1t9s26b9/
my URL.py内部:
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic.base import TemplateView
admin.autodiscover()
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^$','explorer.views.home',name='home'),
url(r'^servers/$','explorer.views.servers'),
url(r'^addserver/$','explorer.views.addserver'),
url(r'^removeserver/$','explorer.views.removeserver'),
url(r'^manage/(?P<server>[\w]+)/(?P<path>[\w]+)/$','manager.views.filemanager'),
url(r'^navback/(?P<server>[\w]+)/(?P<path>[\*\w]+)/$','manager.views.navbackward'),
url(r'^naviforward(?P<server>[\w]+)/(?P<path>[\*\w]+)/(?P<dir>[\w]+)/$','manager.views.navforward'),
url(r'^edit/(?P<server>[\w]+)/(?P<path>[\*\w]+)/(?P<file>[\.\w]+)$','manager.views.editdata'),
url(r'^saveandsend/(?P<server>[\w]+)/(?P<path>[\*\w]+)/(?P<file>[\.\w]+)$','manager.views.senddata'),
url(r'^upload/(?P<server>[\w]+)/(?P<path>[\*\w]+)/$','manager.views.uploadfile'),
url(r'^delete/(?P<server>[\w]+)/(?P<path>[\*\w]+)/(?P<file>[\.\w]+)$','manager.views.deletefile'),
]
我的观点.py内部:
https://postimg.org/image/s2c60qr2d/
用于ssh连接和sftp连接的views.py内部:
https://postimg.org/image/635rdjhxx/
我的html文件路由:
<div class="col-md-4">
{% if path != orginalpath %}
<a href="http://127.0.0.1:8000/navback/{{ server }}/{{ modpath }}/"><span class="glyphicon glyphicon-arrow-left" style="color: #ac2925;height: 30px"></span></a>
{% endif %}
{% for d in dirs %}
<ul>
<li>
<span class="glyphicon glyphicon-folder-close" style="color: #eea236"></span>
<a href="http://127.0.0.1:8000/naviforward/{{ server }}/{{ modpath }}{{ d }}/">{{ d }}</a>
</li>
</ul>
{% endfor %}
</div>
如果您有权访问项目和图像,您可以查看以下链接:
https://postimg.org/gallery/3iakj1t7a/
https://gitlab.com/rection/Cloud-Panel-Django.git
如何解决我的问题
naviforward/<server>matched/<path>matched/<dir>not matched/
naviforward/DigitalOcean/*root*docker-bench-security/
你的正则表达式有3个不同的匹配组,但只给出了2个部分;我还相信
url()
函数采用正则表达式和可调用函数,而不是正则表达式和字符串相关问题 更多 >
编程相关推荐