在sae配置django项目
来源:互联网 发布:软件测试作业 编辑:程序博客网 时间:2024/05/22 06:48
1:使用sae开发必须有sae帐号,自己注册吧;
2:在sae上新建立一个python项目;
3:建立完成之后新建一个版本,即版本1;
4:获取svn的地址在eclipse中check下来;
5:注意check过程中本地建立的项目名称要和sae中建立的应用名称相同;
6:注意在建立本地的django项目时不用勾选生成src目录;
7:check完成之后建立views.py文件并且编写:
from django.http import HttpResponse
def hello(request):
return HttpResponse("Hello, world! - Django")
8:配置config.yaml文件
libraries:
- name: "django"
version: "1.4"
9:创建文件index.wsgi,内容如下
import sys
import os.path
# manage.py is automatically created in each Django project. manage.py is a thin
# wrapper around django-admin.py that takes care of two things for you before
# delegating to django-admin.py:
#
# It puts your project's package on sys.path.
# It sets the DJANGO_SETTINGS_MODULE environment variable so that it points to
# your project's settings.py file.
#
# ref: https://docs.djangoproject.com/en/1.4/ref/django-admin/
os.environ['DJANGO_SETTINGS_MODULE'] = 'theonlyyou.settings'
sys.path.append(os.path.join(os.path.dirname(__file__), 'theonlyyou'))
import sae
import django.core.handlers.wsgi
application = sae.create_wsgi_app(django.core.handlers.wsgi.WSGIHandler())
10:Add “django.contrib.admin” to your INSTALLED_APPS setting.在setttings.py文件中打开注释即可;
11:编写urls.py文件
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^mysite/', include('mysite.foo.urls')),
(r'^$', 'theonlyyou.views.hello'),
(r'^demo/$', 'theonlyyou.demo.views.showdemo'),
# Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
)
12:最后完成的项目目录如下图:
13:完成后提交代码
14:访问应用地址,显示结果:Hello, world! - Django
- 在sae配置django项目
- SAE构建Django项目
- SAE 环境 django 配置
- Python+Django+SAE系列教程7-----在Sae上配置Django
- SAE Django配置static文件
- SAE下创建一个django项目
- sae+django配置记录(一)
- Django个人博客部署在SAE
- Python+Django+SAE系列教程6-----本地配置Django
- Django开源项目mezzanine迁移SAE分享
- django项目部署到SAE上的个人博客
- Python+Django+SAE系列教程12-----配置MySQL数据库
- ThinkPHP项目在SAE下的部署
- 在sae上部署J2ee项目入门
- 在SAE搭建Python+Django+MySQL(基于Windows)
- 用django在SAE搭建个人博客(一)
- 用django在SAE搭建个人博客(二)
- Django开发博客(八)——部署在SAE
- UVa11995 I Can Guess the Data Structure!
- do while(0)在宏定义中的应用
- jdk和tomcat的配置
- hdoj 3400 三分
- 努力改正缺点
- 在sae配置django项目
- dijkstra--poj1797
- struts2的配置
- adb server出现异常无法调试程序
- ExtJs4.0的 数据模型刨析(Anatomy of a model)
- uva-1427 Parade (单调队列优化dp)
- 高效求幂取余 算法,复杂度 log(n)
- ubuntu12.04创建程序的快捷方式
- 用Eclipse打包jar程序直接运行(1.源码)_hanCSDN_20130817