0
ecomstore/settings.py類型錯誤在/ MyApp的/你好/你好()恰恰2個參數(1給出)
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'uploader',
'myapp',
)
ecomstore/urls.py
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'ecomstore.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^catalog/$', 'ecomstore.views.catalog'),
url(r'^myapp/', include(myapp.urls)),
url(r'^upload/$', 'uploader.views.home', name = 'imageupload'),
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
MYAPP/urls.py
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^hello/', 'myapp.views.hello', name = 'hello'),
)
MYAPP/views.py
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def hello(request, number):
text = "<h1>welcome to my app number %s!</h1>"% number
return render(request, "myapp/template/hello.html", {})
return HttpResponse(text)
更改URL(R後 '^的myapp /',包括( 'myapp.urls'),當我把在本地主機URL:在8000/MYAPP/MYAPP /你好/它拋出類型錯誤/你好/
打招呼()到底需要2個參數(1給出)
請指導我
感謝。