├── .gitignore ├── README.md ├── app.conf ├── db.sqlite3 ├── favicon.ico ├── index.py ├── manage.py ├── requirements.txt └── zqxt ├── __init__.py ├── settings.py ├── urls.py └── wsgi.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions 6 | *.so 7 | 8 | # Distribution / packaging 9 | .Python 10 | env/ 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | lib/ 17 | lib64/ 18 | parts/ 19 | sdist/ 20 | var/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | 25 | # PyInstaller 26 | # Usually these files are written by a python script from a template 27 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 28 | *.manifest 29 | *.spec 30 | 31 | # Installer logs 32 | pip-log.txt 33 | pip-delete-this-directory.txt 34 | 35 | # Unit test / coverage reports 36 | htmlcov/ 37 | .tox/ 38 | .coverage 39 | .cache 40 | nosetests.xml 41 | coverage.xml 42 | 43 | # Translations 44 | *.mo 45 | *.pot 46 | 47 | # Django stuff: 48 | *.log 49 | 50 | # Sphinx documentation 51 | docs/_build/ 52 | 53 | # PyBuilder 54 | target/ 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BAE_Django 2 | 3 | BAE上部署Django项目的例子, 在BAE上实测通过 4 | 5 | 用户名密码均为 zqxt 6 | 7 | 更多Django教程:[自强学堂Django教程](http://www.ziqiangxuetang.com/django/django-tutorial.html) 8 | 9 | [BAE 网站地址](http://bce.baidu.com/product/bae.html) 10 | -------------------------------------------------------------------------------- /app.conf: -------------------------------------------------------------------------------- 1 | ########################## BAE application config file ###################### 2 | # 3 | # app.conf 采用YAML格式, 请参考 http://yaml.org/ 4 | # 请尽量不要在配置部分使用中文,以免发布失败 5 | # 请不要使用TAB键,应该使用空格 6 | # 一定要注意对齐,否则发布会失败 7 | # app.conf 详细功能,请参考: 8 | # http://developer.baidu.com/wiki/index.php?title=docs/cplat/rt/manage/conf 9 | # http://godbae.duapp.com/?p=654 10 | # 11 | ############################################################################## 12 | 13 | handlers: 14 | - url : /static/(.+) 15 | script : /static/$1 16 | 17 | - url : /media/(.+) 18 | script : /media/$1 19 | 20 | - url : (.+)\.js$ 21 | script : $1.js 22 | 23 | - url : (.+)\.css$ 24 | script : $1.css 25 | 26 | - url : (.+)\.xml$ 27 | script : $1.xml 28 | 29 | - url : (.+)\.xsl$ 30 | script : $1.xsl 31 | 32 | - url : (.+)\.jpg$ 33 | script : $1.jpg 34 | 35 | - url : (.+)\.jpeg$ 36 | script : $1.jpeg 37 | 38 | - url : (.+)\.png$ 39 | script : $1.png 40 | 41 | - url : (.+)\.gif$ 42 | script : $1.gif 43 | 44 | - url : (.+)\.txt$ 45 | script : $1.txt 46 | 47 | - url : (.+)\.zip$ 48 | script : $1.zip 49 | 50 | - url : (.+)\.rar$ 51 | script : $1.rar 52 | 53 | - url : (.+)\.tar\.gz$ 54 | script : $1.tar.gz 55 | 56 | - url : (.+)\.mp4$ 57 | script : $1.mp4 58 | 59 | - url : (.+)\.mp3$ 60 | script : $1.mp3 61 | 62 | - url : /favicon.ico 63 | script : /favicon.ico 64 | 65 | - url : /.* 66 | script : index.py 67 | 68 | - expire : .jpg modify 10 years 69 | - expire : .swf modify 10 years 70 | - expire : .png modify 10 years 71 | - expire : .gif modify 10 years 72 | - expire : .JPG modify 10 years 73 | - expire : .ico modify 10 years -------------------------------------------------------------------------------- /db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twz915/BAE_Django/f4c2399779dbbf3d0c782fdc14c4338f54b35e93/db.sqlite3 -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twz915/BAE_Django/f4c2399779dbbf3d0c782fdc14c4338f54b35e93/favicon.ico -------------------------------------------------------------------------------- /index.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # @Date : 2015-01-17 13:45:07 4 | # @Author : Weizhong Tu (mail@tuweizhong.com) 5 | # @Link : http://www.tuweizhong.com 6 | 7 | import os 8 | os.environ['DJANGO_SETTINGS_MODULE'] = 'zqxt.settings' 9 | 10 | from django.core.wsgi import get_wsgi_application 11 | from bae.core.wsgi import WSGIApplication 12 | application = WSGIApplication(get_wsgi_application()) -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zqxt.settings") 7 | 8 | from django.core.management import execute_from_command_line 9 | 10 | execute_from_command_line(sys.argv) 11 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Django==1.6.10 2 | south==0.8.4 3 | MySQL-python -------------------------------------------------------------------------------- /zqxt/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twz915/BAE_Django/f4c2399779dbbf3d0c782fdc14c4338f54b35e93/zqxt/__init__.py -------------------------------------------------------------------------------- /zqxt/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for zqxt project. 3 | 4 | For more information on this file, see 5 | https://docs.djangoproject.com/en/1.6/topics/settings/ 6 | 7 | For the full list of settings and their values, see 8 | https://docs.djangoproject.com/en/1.6/ref/settings/ 9 | """ 10 | 11 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 12 | import os 13 | BASE_DIR = os.path.dirname(os.path.dirname(__file__)) 14 | 15 | 16 | # Quick-start development settings - unsuitable for production 17 | # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ 18 | 19 | # SECURITY WARNING: keep the secret key used in production secret! 20 | SECRET_KEY = '!f@ln21ff(yz87nurts0i4$$!=&u-8uj1yyc!w71l-*rjg62sr' 21 | 22 | # SECURITY WARNING: don't run with debug turned on in production! 23 | DEBUG = True 24 | 25 | TEMPLATE_DEBUG = True 26 | 27 | ALLOWED_HOSTS = [] 28 | 29 | 30 | # Application definition 31 | 32 | INSTALLED_APPS = ( 33 | 'django.contrib.admin', 34 | 'django.contrib.auth', 35 | 'django.contrib.contenttypes', 36 | 'django.contrib.sessions', 37 | 'django.contrib.messages', 38 | 'django.contrib.staticfiles', 39 | ) 40 | 41 | MIDDLEWARE_CLASSES = ( 42 | 'django.contrib.sessions.middleware.SessionMiddleware', 43 | 'django.middleware.common.CommonMiddleware', 44 | 'django.middleware.csrf.CsrfViewMiddleware', 45 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 46 | 'django.contrib.messages.middleware.MessageMiddleware', 47 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 48 | ) 49 | 50 | ROOT_URLCONF = 'zqxt.urls' 51 | 52 | WSGI_APPLICATION = 'zqxt.wsgi.application' 53 | 54 | 55 | # Database 56 | # https://docs.djangoproject.com/en/1.6/ref/settings/#databases 57 | 58 | DATABASES = { 59 | 'default': { 60 | 'ENGINE': 'django.db.backends.sqlite3', 61 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 62 | } 63 | } 64 | 65 | # Internationalization 66 | # https://docs.djangoproject.com/en/1.6/topics/i18n/ 67 | 68 | LANGUAGE_CODE = 'en-us' 69 | 70 | TIME_ZONE = 'UTC' 71 | 72 | USE_I18N = True 73 | 74 | USE_L10N = True 75 | 76 | USE_TZ = True 77 | 78 | 79 | # Static files (CSS, JavaScript, Images) 80 | # https://docs.djangoproject.com/en/1.6/howto/static-files/ 81 | 82 | STATIC_URL = '/static/' 83 | -------------------------------------------------------------------------------- /zqxt/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import patterns, include, url 2 | 3 | from django.contrib import admin 4 | admin.autodiscover() 5 | 6 | urlpatterns = patterns('', 7 | # Examples: 8 | # url(r'^$', 'zqxt.views.home', name='home'), 9 | # url(r'^blog/', include('blog.urls')), 10 | 11 | url(r'^admin/', include(admin.site.urls)), 12 | ) 13 | -------------------------------------------------------------------------------- /zqxt/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for zqxt project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zqxt.settings") 12 | 13 | from django.core.wsgi import get_wsgi_application 14 | application = get_wsgi_application() 15 | --------------------------------------------------------------------------------