Django Basics myapp mapping in myproject "myapp" is not defined
Question: I am learning django, and have ran `python manage.py startapp myapp` which
created the following folder structure:

    
    
    myapp/
       __init__.py
       admin.py
       models.py
       tests.py
       views.py
    

I also added `myapp` to `INSTALLED_APPS` in settings,

    
    
    INSTALLED_APPS = (
       'django.contrib.admin',
       'django.contrib.auth',
       'django.contrib.contenttypes',
       'django.contrib.sessions',
       'django.contrib.messages',
       'django.contrib.staticfiles',
       'myapp',
    )
    

then I ran `python manage.py migrate` and `python manage.py createsuperuser`
to create super user

I have also created views of myapp :

    
    
    "from django.http import HttpResponse
    
    def hello(request):
       text = """<h1>welcome to my app !</h1>"""
       return HttpResponse(text)
    "
    

Finally, here's the URL mapping:

    
    
    from django.conf.urls import patterns, include, url
    from django.contrib import admin
    admin.autodiscover()
    urlpatterns = patterns('',
       url(r'^admin', include(admin.site.urls)),
       url(r'^hello/', 'myapp.views.hello', name = 'hello'),
    )
    

When ran, it throws an error stating that "myapp" is not defined. And I am not
able to access admin page at <http://127.0.0.1:8000/admin>

How can I solve this error and get my application to work?


Answer: Possibly `myapp` is not included in `INSTALLED_APPS` in `setting.py`. I
suppose you are following
[this](http://www.tutorialspoint.com/django/django_url_mapping.htm) tutorial.

