Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Basics What a View! What Are URLs?

My Hello World page is not working?

I keep getting this

Workspace Unavailable This is a preview link for a Treehouse Workspace that is not currently active.

If you are the workspace owner, you can launch it again via the Treehouse site.

I followed the video tutorial exactly not sure what to do

18 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,423 Points

Using the "eye" icon to preview the workspace only works if there is an active process running. Did you remember to start you webserver using:

treehouse:~/workspace/learning_site$ python manage.py runserver 0.0.0.0:8000

Also, be sure that the preview port number matches the port number in your launch command. "8000" in this case.

Post back if you need more help. Good luck!

Chris Freeman now I'm getting a syntax error here is my code

urls.py
from django.conf.urls import url
from django.contrib import admin

from . import views

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$' views.hello_world),
]
Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

Be sure to wrapped included urls with include():

    url(r'^admin/', include(admin.site.urls)), 

and to import include from django.conf.urls

Chris Freeman That's not working

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

OK. At this point I need more code. Can you paste your current urls.py file and the complete stacktrace included with the error message or syntax error?

from django.conf.urls import url
from django.conf.urls import include
from django.contrib import admin

from . import views

urlpatterns = [
    url(r'^admin/', admin.site.urls)),
    url(r'^$' views.hello_world),
]

[MOD: added ```python formatting -cf]

File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed                                                              
  File "/home/treehouse/workspace/learning_site/learning_site/urls.py", line 23                                                             
    url(r'^admin/', admin.site.urls)),                                                                                                      
                                    ^                                                                                                       
SyntaxError: invalid syntax

from django.conf.urls import url , include from django.contrib import admin

from . import views

urlpatterns = [ url(r'^admin/', admin.site.urls)), url(r'^$' views.hello_world), ]

File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed                                                              
  File "/home/treehouse/workspace/learning_site/learning_site/urls.py", line 22                                                             
    url(r'^admin/', admin.site.urls)),                                                                                                      
                                                    ^                                                                                    
SyntaxError: invalid syntax
Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

Be sure to wrapped included urls with include():

    url(r'^admin/', include(admin.site.urls)), 

and to import include from django.conf.urls

Chris Freeman I put it down two way's I tried it and the arrow is pointing at the wrong letter it's pointing at the third quotation

when I erase the third quotation it points at the views s

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

I don't see you following my suggestion.

# you still have
    url(r'^admin/', admin.site.urls),
# I am suggesting
    url(r'^admin/', include(admin.site.urls)), 
from django.conf.urls import url, include
from django.contrib import admin

from . import views

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

[MOD: added ``` python formatting -cf]

from django.conf.urls import url
from django.conf.urls import include
from django.contrib import admin

from . import views

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

gives me syntax error on url(r'^$' views.hello_world), ^

its under views the arrow

yup it worked looks weird tho

url(r'^$', views.hello_world),

url(r'^$' views.hello_world),

thanks for your help

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

I suggest greeting a new forum post and including the full error stack trace you get. Tag me in the post if you wish with @chrisfreeman3

Chris Freeman you still on