我下面一個tutorial for django,即時通訊主辦我的免費託管的測試項目,的Django的hello world不顯示
託管工作正常使用Python,例如Django的外殼,
,但我看不到正確的數據在我的index.html或有存取權限的/管理員
,所以我認爲這是一個錯誤的路徑問題?
所以請對這個菜鳥問題諮詢,
這是我有我的文件的文件夾/home/mako34/www/blog
這裏我的代碼:
我想設置爲數據庫正確配置,因爲它是建立在sqlite的數據庫,以及必要的文件夾
settings.py中
import os
*
* configure connection do db, etc
*
ROOT_URLCONF = 'blog.urls'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(os.path.dirname(__file__),'templates'), # creates a absolute path
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
urls.py
from django.conf.urls.defaults import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'blog.views.home', name='home'),
# url(r'^blog/', include('blog.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^, 'blog.views.index'), #<------------------- index/root entry
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
)
的index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My Blog</title>
</head>
<body>
<H1>Test Django</H1>
<div id="content">
{% block content %}
{% endblock %}
</div>
</body>
</html>
所以我錯過了什麼IM?
,所以我可以看到我的數據索引HTML [因爲現在它顯示在他們
標籤{% block content %} {% endblock %}
並且沒有數據,不能有存取權限http://mako34.alwaysdata.net/blog/admin/
的感謝!
您是否配置了WSGI兼容的Web服務器以在您的項目中使用wsgi.py模塊? – kosii 2012-03-24 08:49:30
@kosii,嘿,不,我沒有,將搜索如何做到這一點?,謝謝! – MaKo 2012-03-24 08:54:56
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/ – kosii 2012-03-24 08:55:50