Create Polls App In PyCharm
- Launch PyCharm
- Click on Tools->run manage.py Task
- In the manage.py console, type startapp polls
views.py, polls\urls.py, mysite\urls.py
A view is a “type” of Web page in your Django application that generally serves a specific function and has a specific template.
See the official django polls tutorial for more.Otherwise just add the following code into the following files:
from django.http import HttpResponse def index(request): return HttpResponse("Hello, world. You're at the polls index.")
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.index, name='index'), ]
from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ url(r'^polls/', include('polls.urls')), url(r'^admin/', admin.site.urls), ]
Again, do menu->Tools->Run manage.py Task, then call runserver in the manage.py console (if the server isn’t already running).
Enter “http://127.0.0.1:8000/polls/” and you should see “Hello, world. You’re at the polls index.”