注册,添加App,选择python3.5,然后打开控制台
- 搭建python3.5虚拟环境
python --version
virtualenv -p /usr/bin/python3.5 VENV
source VENV/bin/activate
- 安装django
pip install "django<1.9"
- 创建网站
django-admin startproject mvote
cd mvote
python manage.py startapp mysite
- 可以通过网站的file,进行上传template,static file等文件
- 修改setting.py文件
- INSTALLEN_APP加入mysite
- ALLOWED_HOSTS = ['*']
LANGUAGE_CODE = 'zh-CN'
TIME_ZONE = 'Asia/Beijing'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR,'static'),
]
STATIC_ROOT = "/home/guguobao/mvote/staticfiles/"
点击它,修改以下内容,去此之外,还要修改mvote/wsgi.py为同样的内容
# +++++++++++ DJANGO +++++++++++
# To use your own django app use code like this:
import os
import sys
#
## assuming your django settings file is at '/home/guguobao/mysite/mysite/settings.py'
## and your manage.py is is at '/home/guguobao/mysite/manage.py'
path = '/home/guguobao/mvote'
if path not in sys.path:
sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'mvote.settings'
# then:
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
- 修改网页的静态URL