zoukankan      html  css  js  c++  java
  • 在sae配置django项目

    1:使用sae开发必须有sae帐号,自己注册吧;

    2:在sae上新建立一个python项目;

    3:建立完成之后新建一个版本,即版本1

    4:获取svn的地址在eclipsecheck下来;

    5:注意check过程中本地建立的项目名称要和sae中建立的应用名称相同;

    6:注意在建立本地的django项目时不用勾选生成src目录;

    7check完成之后建立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

  • 相关阅读:
    Java学习笔记之---单例模型
    Java学习笔记之---内部类
    Java项目案例之--封装的实例
    Java学习笔记之---构造方法
    Java学习笔记之---static
    Java学习笔记之---面向对象
    咨询顾问与逻辑思客
    最重要与靠不住之间如何平衡
    《网络借贷信息中介机构业务活动管理暂行办法》
    商业银行法律法规与监管要求汇总
  • 原文地址:https://www.cnblogs.com/pangblog/p/3266463.html
Copyright © 2011-2022 走看看