3 Star 4 Fork 2

Gitee 极速下载/ilv_web

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/ilvbobing/ilv_web
克隆/下载
ilvbobing_pythonanywhere_com_wsgi.py 5.51 KB
一键复制 编辑 原始数据 按行查看 历史
ilvbobing 提交于 2020-02-22 20:16 . 数据库设置为SQLite
# This file contains the WSGI configuration required to serve up your
# web application at http://ilvbobing.pythonanywhere.com/
# It works by setting the variable 'application' to a WSGI handler of some
# description.
#
# +++++++++++ GENERAL DEBUGGING TIPS +++++++++++
# getting imports and sys.path right can be fiddly!
# We've tried to collect some general tips here:
# https://help.pythonanywhere.com/pages/DebuggingImportError
# +++++++++++ CUSTOM WSGI +++++++++++
# If you have a WSGI file that you want to serve using PythonAnywhere, perhaps
# in your home directory under version control, then use something like this:
#
import sys
#
#path = '/home/ilvbobing/path/to/my/app
path ='/home/ilvbobing/ilv_web/lib'
if path not in sys.path:
sys.path.append(path)
#
#from my_wsgi_file import application # noqa
# import ilv.MyData
import ilv.Base
import ilv.User
import ilv.News
import ilv.Demo # 演示类
import ilv.Env # 环境类,必须引用,保持数据一致,因为getFormDict只能引用一次,之后就无效了。
import ilv.Column
# +++++++++++ HELLO WORLD +++++++++++
# A little pure-wsgi hello world we've cooked up, just
# to prove everything works. You should delete this
# code to get your own working.
HELLO_WORLD = """<html>
<head>
<title>PythonAnywhere hosted web application</title>
</head>
<body>
<h1>Hello, World2!</h1>
<p>
This is the default welcome page for a
<a href="https://www.pythonanywhere.com/">PythonAnywhere</a>
hosted web application.
</p>
<p>
Find out more about how to configure your own web application
by visiting the <a href="https://www.pythonanywhere.com/web_app_setup/">web app setup</a> page
</p>
</body>
</html>"""
'''
def application(environ, start_response):
if environ.get('PATH_INFO') == '/':
status = '200 OK'
content = HELLO_WORLD
else:
status = '404 NOT FOUND'
content = 'Page not found.'
response_headers = [('Content-Type', 'text/html'), ('Content-Length', str(len(content)))]
start_response(status, response_headers)
yield content.encode('utf8')
'''
###################################################################################################
# The entrance of uWSGI
###################################################################################################
def application(environ,start_response):
###################################################################################################
# 基本参数
###################################################################################################
env = ilv.Env.Env(environ=environ)
base = ilv.Base.Base(env=env)
urlDict = base.urlDict
###################################################################################################
# 获得参数集
###################################################################################################
urlDict = base.urlDict
if "AEE_uploadFinally" in urlDict: # 实现AEE插件上传功能
response_body = "OK"
else:
response_body = base.getHtml()
# response_body = str(environ["wsgi.input"])
#response_body = str(environ)
if urlDict is not None and "demo" in urlDict:
demo = ilv.Demo.Demo(env=env)
response_body = demo.getHtml()
pass
status = "200 OK"
#bHtml = b"" + response_body.encode(encoding="utf-8")
bHtml = response_body # 不再使用二进制流
response_headers = [("Content-Type","text/html"),("Content-Length",str(len(bHtml))),("charset","utf-8"),("Set-Cookie","session=12345")]
start_response(status,response_headers)
yield bHtml.encode('utf8')
#return bHtml
# Below are templates for Django and Flask. You should update the file
# appropriately for the web framework you're using, and then
# click the 'Reload /yourdomain.com/' button on the 'Web' tab to make your site
# live.
# +++++++++++ VIRTUALENV +++++++++++
# If you want to use a virtualenv, set its path on the web app setup tab.
# Then come back here and import your application object as per the
# instructions below
# +++++++++++ DJANGO +++++++++++
# To use your own django app use code like this:
#import os
#import sys
#
## assuming your django settings file is at '/home/ilvbobing/mysite/mysite/settings.py'
## and your manage.py is is at '/home/ilvbobing/mysite/manage.py'
#path = '/home/ilvbobing/mysite'
#if path not in sys.path:
# sys.path.append(path)
#
#os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
#
## then:
#from django.core.wsgi import get_wsgi_application
#application = get_wsgi_application()
# +++++++++++ FLASK +++++++++++
# Flask works like any other WSGI-compatible framework, we just need
# to import the application. Often Flask apps are called "app" so we
# may need to rename it during the import:
#
#
#import sys
#
## The "/home/ilvbobing" below specifies your home
## directory -- the rest should be the directory you uploaded your Flask
## code to underneath the home directory. So if you just ran
## "git clone git@github.com/myusername/myproject.git"
## ...or uploaded files to the directory "myproject", then you should
## specify "/home/ilvbobing/myproject"
#path = '/home/ilvbobing/path/to/flask_app_directory'
#if path not in sys.path:
# sys.path.append(path)
#
#from main_flask_app_file import app as application # noqa
#
# NB -- many Flask guides suggest you use a file called run.py; that's
# not necessary on PythonAnywhere. And you should make sure your code
# does *not* invoke the flask development server with app.run(), as it
# will prevent your wsgi file from working.
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/mirrors/ilv_web.git
git@gitee.com:mirrors/ilv_web.git
mirrors
ilv_web
ilv_web
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385