Don't forget to add your app to the list of INSTALLED_APPS. See below.
On Monday, June 26, 2017 at 4:09:00 AM UTC-6, akhil kumar wrote:
-- On Monday, June 26, 2017 at 4:09:00 AM UTC-6, akhil kumar wrote:
this is my polls/urls.pyfrom django.conf.urls import url
from . import views
urlpatterns=[
url(r'^$',views.index,name='index'),
]
mysite/urls.py
from django.conf.urls import include,url
from django.contrib import admin
urlpatterns = [
url(r'^polls/',include('polls.urls' ,namespace="polls")),
url(r'^admin/', admin.site.urls),
]settings.py
INSTALLED_APPS = [
'polls.apps.PollsConfig'
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'polls',
]
models.py
from django.db import models
# Create your models here.
class Question(models.Model):
question_text=models.CharField(max_length=500)
pub_date=models.DateTimeField('date published' )
class choice(models.Model):
Question=models.ForeignKey(Question,on_delete=models. CASCADE)
choice_text=models.CharField(max_length =500)
votes=models.IntegerField(default =0)
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/98237392-07e9-4068-8044-14b4e117d053%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment