运行django服务器时出现以下错误:
<form method="post" action="">
<select title="Ticket" name="Ticket" required>
<option disabled selected value>Art des Tickets</option>
<option value="1" <?php if (!empty($_POST["submit"]) && $_POST["Ticket"] == 1) {echo 'selected="selected"'; } ?>>Gamer</option>
<option value="2" <?php if (!empty($_POST["submit"]) && $_POST["Ticket"] == 2) {echo 'selected="selected"'; } ?>>Zuschauer</option>
</select>
<input type="submit" name="submit" value="send">
</form>
<?php
if (isset($_POST["submit"]) && $_POST["Ticket"] == 2) {
?>
<div class="FormError">Als Zuschauer kannst du leider nur beim Auf- oder Abbau helfen, nicht jedoch bei beidem, bitte ändere deine Auswahl.</div>
<?php
}
?>
我在通用应用中的网址是:
NoReverseMatch at /
Reverse for 'about' with arguments '()' and keyword arguments '{}' not found. 1 pattern(s) tried: ['$v$']
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.8.6
Exception Type: NoReverseMatch
Exception Value:
Reverse for 'about' with arguments '()' and keyword arguments '{}' not found. 1 pattern(s) tried: ['$v$']
Exception Location: /usr/local/lib/python3.4/dist-packages/django/core/urlresolvers.py in _reverse_with_prefix, line 495
然而,当我将'about'url更改为empty:
时url(r'^v$', views.about, name ='about'),
url(r'^$', views.main_view, name= 'main_view'),
使用关于视图并且页面加载正常。我不明白正则表达式是如何崩溃整个应用程序的。目标是在html模板中使用/ v / url,如下所示:
url(r'^$', views.about, name ='about'),
感谢您的帮助
答案 0 :(得分:0)
在包含模式的末尾有一个$,因此所包含的模式都不会匹配。去掉它。
url(r'', include('generic.urls', namespace='generic', app_name='generic')),