I have this error during template rendering. What i'm trying to do is allow the user to upload a csv then process the data into models.
error at line 109 'myapp' is not a registered namespace
This is my line 109 code
<form action="{% url "myapp:upload_csv" %}" method="POST" enctype="multipart/form-data" class="form-horizontal">
urls.py in mysite
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'', include('anomaly.urls')),
]
urls.py in anomaly
urlpatterns = [
url(r'^$', views.post_list, name='post_list'),
url(r'^upload/csv/$', views.upload_csv, name='upload_csv'),
]
try this
urls.py in mysite
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include('anomaly.urls',namespace='anomaly'))
To qualify a url name with a namespace use the syntax 'namespace:name'
<form action="{% url 'anomaly:upload_csv' %}" method="POST" enctype="multipart/form-data" class="form-horizontal">
It seems that you have switched to Django 2.0 This is one of the change the new version of Django contains.
Go to urls.py of your app anomaly and add the app_name = "anomaly"
. So your urls.py file will be like
app_name = "anomaly"
urlpatterns = [
url(r'^$', views.post_list, name='post_list'),
url(r'^upload/csv/$', views.upload_csv, name='upload_csv'),
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With