Friday, December 9, 2016

Re: Error with Tutorial - Writing your first Django app, part 1

Missing comma on you urlpatterns


urlpatterns = [
    url(r'^polls/', include('polls.urls')) ,
    url(r'^admin/', admin.site.urls),
]




On Fri, Dec 9, 2016 at 4:10 PM, shah <shahmohammad90@gmail.com> wrote:
Hi, I am facing the same issue with the tutorial.

I have got my program correct. But after running the sever. It shows an error on chrome.

Page not found (404)

Request Method:GET
Request URL:http://localhost:8000/polls/

Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:

  1. ^admin/

The current URL, polls/, didn't match any of these.

You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.


Since this is first ste of tutorial. I am not able to move forward. Thanx for rely in advance.

On Tuesday, 11 October 2016 02:12:30 UTC+5:30, Johnny McClung wrote:
I am getting an error when I try to run the Django server. 

>> mysite >> polls >> urls.py
from django.conf.urls import url


from . import views

urlpatters = [
    url(r'^$', views.index, name='index'),
    ]




>> mysite >> mysite >> urls.py
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),
]



Error:

E:\Dropbox\Python Scripts\mysite>python manage.py runserver
Performing system checks...

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x03F616A8>
Traceback (most recent call last):
  File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\commands\runserver.py", line 121, in inner_run
    self.check(display_num_errors=True)
  File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\base.py", line 374, in check
    include_deployment_checks=include_deployment_checks,
  File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\base.py", line 361, in _run_checks
    return checks.run_checks(**kwargs)
  File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\checks\urls.py", line 14, in check_url_config
    return check_resolver(resolver)
  File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\checks\urls.py", line 24, in check_resolver
    for pattern in resolver.url_patterns:
  File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\utils\functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\urls\resolvers.py", line 313, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\utils\functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\urls\resolvers.py", line 306, in urlconf_module
    return import_module(self.urlconf_name)
  File "C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 661, in exec_module
  File "<frozen importlib._bootstrap_external>", line 767, in get_code
  File "<frozen importlib._bootstrap_external>", line 727, in source_to_code
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "E:\Dropbox\Python Scripts\mysite\mysite\urls.py", line 21
    url(r'^admin/', admin.site.urls),
      ^
SyntaxError: invalid syntax


Any help would be appreciated. Thank you. 

--
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/8f685294-3a65-4fce-8be6-d8e46b5ec44c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Fábio C. Barrionuevo da Luz
Palmas - Tocantins - Brasil - América do Sul


Blog colaborativo sobre Python e tecnologias Relacionadas, mantido totalmente no https://github.com/pythonclub/pythonclub.github.io .

Todos são livres para publicar. É só fazer fork, escrever sua postagem e mandar o pull-request. Leia mais sobre como publicar em README.md e contributing.md.
Regra básica de postagem:
"Você" acha interessante? É útil para "você"? Pode ser utilizado com Python ou é útil para quem usa Python? Está esperando o que? Publica logo, que estou louco para ler...

--
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/CAPVjvMbZhm5%2BmROAW7%3DCk7XfPKr-e8VdTMcFNML_OkdqMrMgQQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment