在sae配置django项目
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项目的更多相关文章
- centos7 apache httpd安装和配置django项目
一.安装httpd服务 apache在centos7中是Apache HTTP server.如下对httpd的解释就是Apache HTTP Server.所以想安装apache其实是要安装http ...
- 配置django项目总结
1.在django项目应用文件夹中的models.py文件中导入(1)from django.db import models(2)建立需要的映射的类名和属性类型也就是数据库中的表名和字段名 2.在s ...
- 在linux上配置Django项目
依赖包 [root@web01 ~]# yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqli ...
- ubuntu 下配置django 项目能够被局域网下的其他电脑访问
在项目下的路径下下运行 python manage.py runserver 后面的端口换成其他可用的端口也可以 如何让外网也能访问呢,有待更新
- Django项目基础配置和基本使用
博文配置内容包括: django项目的创建 django项目下应用的创建及配置 数据库的配置 templates模板的配置 命令行创建项目: 在需要的目录下创建Django项目输入命令:django- ...
- Django项目在linux系统中虚拟环境部署
1.在linux系统下,安装virtualenv 命令:pip install virtualenv 2.项目部署前的准备 1. Django web project deployment 1.1. ...
- Django项目部署(django+guncorn+virtualenv+nginx)
一.说明 为了django项目部署到生产环境上,能够稳定的运行,且能够同时指出http和https的访问,对django的部署进行了一些研究,决定采用django + gunicorn + virtu ...
- 在windows上用apache+mod_wsgi服务部署django项目
之前一直在本地跑django项目,最近尝试在服务器上部署项目,目前已经成功部署,也花了好多时间,这里跟大家交流一下,希望对像我一样的新手有帮助. 一.配置环境: 1.Python版本3.7 2.服务器 ...
- Django项目中添加富文本编辑器django-ckeditor
django-ckeditor库的使用步骤: 1.在命令行下安装django-ckeditor这个库: 命令:pip install django-ckeditor 2.安装成功后,配置Django项 ...
随机推荐
- [Typescript] Function defination
Define a function type and params type: // The function init // Accept two params which are both typ ...
- Python之基础(一)
数学计算 要利用相关的数学计算函数,首先需要把数学模块包含进来: >>>import math 进行计算: >>> math.pi 3.14159265358979 ...
- (五)《Java编程思想》——final关键字
可能使用final的三种情况:数据.方法.类. 1.final数据 final 常量必须是基本类型数据,且在定义时须赋值: 一个既是static又是final的域只占据一段不能改变的存储空间,只有一份 ...
- Asp.Net WebApi+Microsoft.AspNet.WebApi.Core 启用CORS跨域访问
WebApi中启用CORS跨域访问 1.安装 Nugget包Microsoft.AspNet.WebApi.Cors This package contains the components to e ...
- (转)asp.net实现忘记密码找回的代码
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or ...
- IPointCollection,ISegmentCollection和IGeometryCollection
Engine 提供了三个主要的几何图形集合接口用于对几何对象的操作,分别是 IPointCollection,ISegmentCollection 和 IGeometryCollection,这些接口 ...
- [c#]asp.net开发微信公众平台(8)微信9大高级接口,自定义菜单
前7篇把最基础的消息接收和回复全做完了, 也把高级接口的入口和分拆处理写好了空方法, 此篇接着介绍微信的9大高级接口, 并着重讲解其中的自定义菜单. 微信9大接口为: 1.语音识别接口 2.客服接 ...
- Swift 循环、数组 字典的遍历
import Foundation // 数组声明 var arr = [String]() // 数组循环添加项 ...{ arr.append("Item \(index)") ...
- POJ 1930 Dead Fraction
POJ 1930 Dead Rraction 此题是一个将无限循环小数转化为分数的题目 对于一个数 x=0.abcdefdef.... 假设其不循环部分的长度为m(如abc的长度为m),循环节的长度为 ...
- ZOJ3556 How Many Sets I(容斥)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud How Many Sets I Time Limit: 2 Seconds ...