That named url worked before, i put another django project and installed few packages like pyjasper etc. My bad I didnt do virtualenv.
Now the other project is not important. Current version of django I am using is 1.6.2. I am not able to trace the error.
It says error rendering
SyntaxError at /dashboard/
invalid syntax (views.py, line 7)
Error during template rendering In template D:\\djangoprojects\\prmanager\\templates\\menu.html, error at line 3
1 {% load static %}
2 <li class="active">
3 <a href="{% url 'dashboard' %}">
4 <i class="fa fa-dashboard"></i> <span>Dashboard</span>
5 </a>
6 </li>
7
8 <li class="treeview">
9 <a href="#">
10 <i class="fa fa-folder"></i> <span>Work Orders</span>
11 <i class="fa fa-angle-left pull-right"></i>
12 </a>
13 <ul class="treeview-menu">
Notice line number 3. I tried named them with quotes and without.
Not able to find which views.py its talking about. Because in the dashboard app, there is no line no 7 in views.py
Can somebody throw some light as to where to look for the bug. If this info is not sufficient, please let me know and I will post the same.
What I do know is, what was working before, stopped working.
Edit urls.py
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'prmanager.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^dashboard/', include('dashboard.urls')),
url(r'^materials/', include('materials.urls')),
url(r'^suppliers/', include('suppliers.urls')),
url(r'^purchaserequest/', include('purchaserequest.urls')),
url(r'^purchaseorder/', include('purchaseorder.urls'), name="purchaseorder"),
url(r'^admin/', include(admin.site.urls)),
url(r'^getSuppliersJson/', 'commontools.tools.getSuppliersJson', name="getSuppliersJson"),
url(r'^getPOJson/', 'commontools.tools.getPOJson', name="getPOJson"),
) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
Dashboard app's urls.py
from django.conf.urls import patterns, url
urlpatterns = patterns('dashboard.views',
url(r'^$', 'dashboard', name="dashboard"),
#url(r'^newpurchaserequest/', 'newpurchaserequest', name="newpurchaserequest"),
)
You are already placing the error,
SyntaxError at /dashboard/
invalid syntax (views.py, line 7)
So problem is in your views.py file at line 7.
Update:
you are included dashboard urls.py, but at the same time you used $
. It is not matching next sub patterns.
yes now problem is here url(r'^dashboard/$', include('dashboard.urls')),
use this url(r'^dashboard/', include('dashboard.urls')),
app configuration is like this,
In root urls.py:
urlpatterns = patterns('',
url(r'^dashboard/', include('dashboard.urls')),
)
In dashboard app:
In urls.py:
urlpatterns = patterns('dashboard.views',
url(r'^$', 'dashboard', name="dashboard"),
)
In views.py:
def dashboard(request):
context = {}
return render(request, 'dashboard/dashboard.html', context)
You should be using this syntax:
{% url 'dashboard' as dashboard_url %}
<a href="{{ dashboard_url }}">Link</a>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.