完成腾讯云部署
This commit is contained in:
108
.env
108
.env
@@ -1,136 +1,40 @@
|
||||
# ========================================
|
||||
# Flask提示词大师应用环境变量配置示例
|
||||
# Flask提示词大师应用环境变量配置
|
||||
# ========================================
|
||||
# 复制此文件为 .env 并根据实际情况修改配置
|
||||
# cp env.example .env
|
||||
|
||||
# ========================================
|
||||
# Flask基础配置
|
||||
# ========================================
|
||||
# Flask应用密钥(必需)
|
||||
SECRET_KEY=your-secret-key-here
|
||||
|
||||
# 应用环境(development/production/testing/local)
|
||||
FLASK_ENV=development
|
||||
|
||||
# ========================================
|
||||
# 数据库配置
|
||||
# ========================================
|
||||
# 数据库连接URL(必需)
|
||||
# MySQL示例: mysql+pymysql://username:password@localhost:3306/database_name?charset=utf8mb4
|
||||
# SQLite示例: sqlite:///app.db
|
||||
# PostgreSQL示例: postgresql://username:password@localhost:5432/database_name
|
||||
DATABASE_URL=mysql+pymysql://root:123456@localhost:3306/pro_db?charset=utf8mb4
|
||||
# 数据库配置 - 腾讯云数据库
|
||||
DATABASE_URL=mysql+pymysql://root:!Rjb12191@gz-cynosdbmysql-grp-d26pzce5.sql.tencentcdb.com:24936/pro_db?charset=utf8mb4
|
||||
|
||||
# ========================================
|
||||
# OpenAI兼容API配置
|
||||
# ========================================
|
||||
# API基础URL(必需)
|
||||
LLM_API_URL=https://api.deepseek.com/v1
|
||||
LLM_API_KEY=sk-fdf7cc1c73504e628ec0119b7e11b8cc
|
||||
|
||||
# API密钥(必需)
|
||||
LLM_API_KEY=sk-your-api-key-here
|
||||
|
||||
# ========================================
|
||||
# 微信小程序配置
|
||||
# ========================================
|
||||
# 小程序AppID(必需)
|
||||
WX_APPID=wx-your-appid-here
|
||||
WX_APPID=wx2c65877d37fc29bf
|
||||
WX_SECRET=89aa97dda3c1347c6ae3d6ab4627f1f4
|
||||
|
||||
# 小程序Secret(必需)
|
||||
WX_SECRET=your-wx-secret-here
|
||||
|
||||
# ========================================
|
||||
# 跨域配置
|
||||
# ========================================
|
||||
# 允许跨域的域名,多个用逗号分隔
|
||||
# 开发环境: http://localhost:3000,http://127.0.0.1:3000
|
||||
# 生产环境: https://yourdomain.com,https://www.yourdomain.com
|
||||
CORS_ORIGINS=http://localhost:3000,http://127.0.0.1:3000
|
||||
|
||||
# ========================================
|
||||
# 日志配置
|
||||
# ========================================
|
||||
# 日志级别(DEBUG/INFO/WARNING/ERROR/CRITICAL)
|
||||
LOG_LEVEL=INFO
|
||||
|
||||
# 日志文件路径
|
||||
LOG_FILE=logs/app.log
|
||||
|
||||
# ========================================
|
||||
# 缓存配置
|
||||
# ========================================
|
||||
# 缓存类型(simple/redis/memcached)
|
||||
CACHE_TYPE=simple
|
||||
|
||||
# 缓存默认超时时间(秒)
|
||||
CACHE_DEFAULT_TIMEOUT=300
|
||||
|
||||
# Redis缓存URL(当CACHE_TYPE=redis时使用)
|
||||
# REDIS_URL=redis://localhost:6379/0
|
||||
|
||||
# ========================================
|
||||
# 会话配置
|
||||
# ========================================
|
||||
# 会话生命周期(小时)
|
||||
SESSION_LIFETIME_HOURS=24
|
||||
|
||||
# ========================================
|
||||
# 文件上传配置
|
||||
# ========================================
|
||||
# 最大文件上传大小(字节)
|
||||
MAX_CONTENT_LENGTH=16777216
|
||||
|
||||
# 文件上传目录
|
||||
UPLOAD_FOLDER=uploads
|
||||
|
||||
# ========================================
|
||||
# 安全配置
|
||||
# ========================================
|
||||
# 是否启用CSRF保护
|
||||
WTF_CSRF_ENABLED=True
|
||||
|
||||
# CSRF令牌超时时间(秒)
|
||||
WTF_CSRF_TIME_LIMIT=3600
|
||||
|
||||
# ========================================
|
||||
# 邮件配置(生产环境错误报告)
|
||||
# ========================================
|
||||
# 邮件服务器地址
|
||||
# MAIL_SERVER=smtp.gmail.com
|
||||
|
||||
# 邮件服务器端口
|
||||
# MAIL_PORT=587
|
||||
|
||||
# 发件人邮箱
|
||||
# MAIL_FROM=noreply@yourdomain.com
|
||||
|
||||
# 管理员邮箱(多个用逗号分隔)
|
||||
# ADMIN_EMAIL=admin@yourdomain.com
|
||||
|
||||
# ========================================
|
||||
# 性能配置
|
||||
# ========================================
|
||||
# 数据库连接池大小
|
||||
# DB_POOL_SIZE=20
|
||||
|
||||
# 数据库连接池最大溢出连接数
|
||||
# DB_MAX_OVERFLOW=30
|
||||
|
||||
# ========================================
|
||||
# 开发工具配置
|
||||
# ========================================
|
||||
# 是否启用自动重载
|
||||
# FLASK_DEBUG=True
|
||||
|
||||
# 是否启用详细错误页面
|
||||
# FLASK_DEBUG_TB_ENABLED=True
|
||||
|
||||
# ========================================
|
||||
# 监控配置
|
||||
# ========================================
|
||||
# 是否启用性能监控
|
||||
# ENABLE_MONITORING=False
|
||||
|
||||
# 监控数据收集间隔(秒)
|
||||
# MONITORING_INTERVAL=60
|
||||
|
||||
40
config.py
40
config.py
@@ -1,3 +1,26 @@
|
||||
# import os
|
||||
# from dotenv import load_dotenv
|
||||
|
||||
# # 在配置类定义前加载环境变量
|
||||
# load_dotenv()
|
||||
|
||||
# class Config:
|
||||
# SECRET_KEY = os.environ.get('SECRET_KEY') or 'dev-key'
|
||||
|
||||
# # MySQL数据库配置
|
||||
# SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'mysql+pymysql://root:123456@localhost:3306/pro_db?charset=utf8mb4'
|
||||
# SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
|
||||
# # OpenAI兼容API配置
|
||||
# LLM_API_URL = os.environ.get('LLM_API_URL') or 'https://api.deepseek.com/v1'
|
||||
# LLM_API_KEY = os.environ.get('LLM_API_KEY') or 'sk-fdf7cc1c73504e628ec0119b7e11b8cc'
|
||||
|
||||
# # 微信小程序配置
|
||||
# WX_APPID = os.environ.get('WX_APPID') or 'wx2c65877d37fc29bf' # 替换为你的小程序 appid
|
||||
# WX_SECRET = os.environ.get('WX_SECRET') or '89aa97dda3c1347c6ae3d6ab4627f1f4' # 替换为你的小程序 secret
|
||||
|
||||
# # 添加跨域支持
|
||||
# CORS_ORIGINS = ['*'] # 生产环境建议设置具体域名
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
@@ -7,10 +30,19 @@ load_dotenv()
|
||||
class Config:
|
||||
SECRET_KEY = os.environ.get('SECRET_KEY') or 'dev-key'
|
||||
|
||||
# MySQL数据库配置
|
||||
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:123456@localhost:3306/pro_db?charset=utf8mb4'
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
# ---------------------- 原有本地MySQL数据库配置 ----------------------
|
||||
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'mysql+pymysql://root:123456@localhost:3306/pro_db?charset=utf8mb4'
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False # 关闭SQLAlchemy的修改跟踪(减少性能消耗)
|
||||
|
||||
# ---------------------- 新增:腾讯云数据库配置 ----------------------
|
||||
# 腾讯云数据库连接URI(格式:mysql+pymysql://用户名:密码@数据库地址:端口/数据库名?charset=utf8mb4)
|
||||
# 注意:需先在腾讯云控制台创建目标数据库(如命名为 pro_db_tencent,需替换为你的实际库名)
|
||||
TENCENT_SQLALCHEMY_DATABASE_URI = os.environ.get('TENCENT_DATABASE_URL') or \
|
||||
'mysql+pymysql://root:!Rjb12191@gz-cynosdbmysql-grp-d26pzce5.sql.tencentcdb.com:24936/pro_db?charset=utf8mb4'
|
||||
# 腾讯云数据库同样关闭修改跟踪(与本地配置保持一致)
|
||||
TENCENT_SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
|
||||
# ---------------------- 其他原有配置(保持不变) ----------------------
|
||||
# OpenAI兼容API配置
|
||||
LLM_API_URL = os.environ.get('LLM_API_URL') or 'https://api.deepseek.com/v1'
|
||||
LLM_API_KEY = os.environ.get('LLM_API_KEY') or 'sk-fdf7cc1c73504e628ec0119b7e11b8cc'
|
||||
@@ -20,4 +52,4 @@ class Config:
|
||||
WX_SECRET = os.environ.get('WX_SECRET') or '89aa97dda3c1347c6ae3d6ab4627f1f4' # 替换为你的小程序 secret
|
||||
|
||||
# 添加跨域支持
|
||||
CORS_ORIGINS = ['*'] # 生产环境建议设置具体域名
|
||||
CORS_ORIGINS = ['*'] # 生产环境建议设置具体域名(如 ['https://your-domain.com'])
|
||||
78
myenv/bin/activate
Normal file
78
myenv/bin/activate
Normal file
@@ -0,0 +1,78 @@
|
||||
# This file must be used with "source bin/activate" *from bash*
|
||||
# you cannot run it directly
|
||||
|
||||
deactivate () {
|
||||
unset -f pydoc >/dev/null 2>&1
|
||||
|
||||
# reset old environment variables
|
||||
# ! [ -z ${VAR+_} ] returns true if VAR is declared at all
|
||||
if ! [ -z "${_OLD_VIRTUAL_PATH+_}" ] ; then
|
||||
PATH="$_OLD_VIRTUAL_PATH"
|
||||
export PATH
|
||||
unset _OLD_VIRTUAL_PATH
|
||||
fi
|
||||
if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then
|
||||
PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
|
||||
export PYTHONHOME
|
||||
unset _OLD_VIRTUAL_PYTHONHOME
|
||||
fi
|
||||
|
||||
# This should detect bash and zsh, which have a hash command that must
|
||||
# be called to get it to forget past commands. Without forgetting
|
||||
# past commands the $PATH changes we made may not be respected
|
||||
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
|
||||
hash -r 2>/dev/null
|
||||
fi
|
||||
|
||||
if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then
|
||||
PS1="$_OLD_VIRTUAL_PS1"
|
||||
export PS1
|
||||
unset _OLD_VIRTUAL_PS1
|
||||
fi
|
||||
|
||||
unset VIRTUAL_ENV
|
||||
if [ ! "${1-}" = "nondestructive" ] ; then
|
||||
# Self destruct!
|
||||
unset -f deactivate
|
||||
fi
|
||||
}
|
||||
|
||||
# unset irrelevant variables
|
||||
deactivate nondestructive
|
||||
|
||||
VIRTUAL_ENV="/home/renjianbo/aitsc/myenv"
|
||||
export VIRTUAL_ENV
|
||||
|
||||
_OLD_VIRTUAL_PATH="$PATH"
|
||||
PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||
export PATH
|
||||
|
||||
# unset PYTHONHOME if set
|
||||
if ! [ -z "${PYTHONHOME+_}" ] ; then
|
||||
_OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
|
||||
unset PYTHONHOME
|
||||
fi
|
||||
|
||||
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
|
||||
_OLD_VIRTUAL_PS1="$PS1"
|
||||
if [ "x" != x ] ; then
|
||||
PS1="$PS1"
|
||||
else
|
||||
PS1="(`basename \"$VIRTUAL_ENV\"`) $PS1"
|
||||
fi
|
||||
export PS1
|
||||
fi
|
||||
|
||||
# Make sure to unalias pydoc if it's already there
|
||||
alias pydoc 2>/dev/null >/dev/null && unalias pydoc
|
||||
|
||||
pydoc () {
|
||||
python -m pydoc "$@"
|
||||
}
|
||||
|
||||
# This should detect bash and zsh, which have a hash command that must
|
||||
# be called to get it to forget past commands. Without forgetting
|
||||
# past commands the $PATH changes we made may not be respected
|
||||
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
|
||||
hash -r 2>/dev/null
|
||||
fi
|
||||
36
myenv/bin/activate.csh
Normal file
36
myenv/bin/activate.csh
Normal file
@@ -0,0 +1,36 @@
|
||||
# This file must be used with "source bin/activate.csh" *from csh*.
|
||||
# You cannot run it directly.
|
||||
# Created by Davide Di Blasi <davidedb@gmail.com>.
|
||||
|
||||
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate && unalias pydoc'
|
||||
|
||||
# Unset irrelevant variables.
|
||||
deactivate nondestructive
|
||||
|
||||
setenv VIRTUAL_ENV "/home/renjianbo/aitsc/myenv"
|
||||
|
||||
set _OLD_VIRTUAL_PATH="$PATH"
|
||||
setenv PATH "$VIRTUAL_ENV/bin:$PATH"
|
||||
|
||||
|
||||
|
||||
if ("" != "") then
|
||||
set env_name = ""
|
||||
else
|
||||
set env_name = `basename "$VIRTUAL_ENV"`
|
||||
endif
|
||||
|
||||
# Could be in a non-interactive environment,
|
||||
# in which case, $prompt is undefined and we wouldn't
|
||||
# care about the prompt anyway.
|
||||
if ( $?prompt ) then
|
||||
set _OLD_VIRTUAL_PROMPT="$prompt"
|
||||
set prompt = "[$env_name] $prompt"
|
||||
endif
|
||||
|
||||
unset env_name
|
||||
|
||||
alias pydoc python -m pydoc
|
||||
|
||||
rehash
|
||||
|
||||
76
myenv/bin/activate.fish
Normal file
76
myenv/bin/activate.fish
Normal file
@@ -0,0 +1,76 @@
|
||||
# This file must be used using `. bin/activate.fish` *within a running fish ( http://fishshell.com ) session*.
|
||||
# Do not run it directly.
|
||||
|
||||
function deactivate -d 'Exit virtualenv mode and return to the normal environment.'
|
||||
# reset old environment variables
|
||||
if test -n "$_OLD_VIRTUAL_PATH"
|
||||
set -gx PATH $_OLD_VIRTUAL_PATH
|
||||
set -e _OLD_VIRTUAL_PATH
|
||||
end
|
||||
|
||||
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
|
||||
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME
|
||||
end
|
||||
|
||||
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
|
||||
# Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`.
|
||||
set -l fish_function_path
|
||||
|
||||
# Erase virtualenv's `fish_prompt` and restore the original.
|
||||
functions -e fish_prompt
|
||||
functions -c _old_fish_prompt fish_prompt
|
||||
functions -e _old_fish_prompt
|
||||
set -e _OLD_FISH_PROMPT_OVERRIDE
|
||||
end
|
||||
|
||||
set -e VIRTUAL_ENV
|
||||
|
||||
if test "$argv[1]" != 'nondestructive'
|
||||
# Self-destruct!
|
||||
functions -e pydoc
|
||||
functions -e deactivate
|
||||
end
|
||||
end
|
||||
|
||||
# Unset irrelevant variables.
|
||||
deactivate nondestructive
|
||||
|
||||
set -gx VIRTUAL_ENV "/home/renjianbo/aitsc/myenv"
|
||||
|
||||
set -gx _OLD_VIRTUAL_PATH $PATH
|
||||
set -gx PATH "$VIRTUAL_ENV/bin" $PATH
|
||||
|
||||
# Unset `$PYTHONHOME` if set.
|
||||
if set -q PYTHONHOME
|
||||
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
|
||||
set -e PYTHONHOME
|
||||
end
|
||||
|
||||
function pydoc
|
||||
python -m pydoc $argv
|
||||
end
|
||||
|
||||
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
|
||||
# Copy the current `fish_prompt` function as `_old_fish_prompt`.
|
||||
functions -c fish_prompt _old_fish_prompt
|
||||
|
||||
function fish_prompt
|
||||
# Save the current $status, for fish_prompts that display it.
|
||||
set -l old_status $status
|
||||
|
||||
# Prompt override provided?
|
||||
# If not, just prepend the environment name.
|
||||
if test -n ""
|
||||
printf '%s%s' "" (set_color normal)
|
||||
else
|
||||
printf '%s(%s) ' (set_color normal) (basename "$VIRTUAL_ENV")
|
||||
end
|
||||
|
||||
# Restore the original $status
|
||||
echo "exit $old_status" | source
|
||||
_old_fish_prompt
|
||||
end
|
||||
|
||||
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
|
||||
end
|
||||
34
myenv/bin/activate_this.py
Normal file
34
myenv/bin/activate_this.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""By using execfile(this_file, dict(__file__=this_file)) you will
|
||||
activate this virtualenv environment.
|
||||
|
||||
This can be used when you must use an existing Python interpreter, not
|
||||
the virtualenv bin/python
|
||||
"""
|
||||
|
||||
try:
|
||||
__file__
|
||||
except NameError:
|
||||
raise AssertionError(
|
||||
"You must run this like execfile('path/to/activate_this.py', dict(__file__='path/to/activate_this.py'))")
|
||||
import sys
|
||||
import os
|
||||
|
||||
old_os_path = os.environ.get('PATH', '')
|
||||
os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + os.pathsep + old_os_path
|
||||
base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if sys.platform == 'win32':
|
||||
site_packages = os.path.join(base, 'Lib', 'site-packages')
|
||||
else:
|
||||
site_packages = os.path.join(base, 'lib', 'python%s' % sys.version[:3], 'site-packages')
|
||||
prev_sys_path = list(sys.path)
|
||||
import site
|
||||
site.addsitedir(site_packages)
|
||||
sys.real_prefix = sys.prefix
|
||||
sys.prefix = base
|
||||
# Move the added items to the front of the path:
|
||||
new_sys_path = []
|
||||
for item in list(sys.path):
|
||||
if item not in prev_sys_path:
|
||||
new_sys_path.append(item)
|
||||
sys.path.remove(item)
|
||||
sys.path[:0] = new_sys_path
|
||||
11
myenv/bin/easy_install
Executable file
11
myenv/bin/easy_install
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/home/renjianbo/aitsc/myenv/bin/python3
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
|
||||
from setuptools.command.easy_install import main
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
11
myenv/bin/easy_install-3.6
Executable file
11
myenv/bin/easy_install-3.6
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/home/renjianbo/aitsc/myenv/bin/python3
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
|
||||
from setuptools.command.easy_install import main
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
11
myenv/bin/pip
Executable file
11
myenv/bin/pip
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/home/renjianbo/aitsc/myenv/bin/python3
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
|
||||
from pip import main
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
11
myenv/bin/pip3
Executable file
11
myenv/bin/pip3
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/home/renjianbo/aitsc/myenv/bin/python3
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
|
||||
from pip import main
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
11
myenv/bin/pip3.6
Executable file
11
myenv/bin/pip3.6
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/home/renjianbo/aitsc/myenv/bin/python3
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
|
||||
from pip import main
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
1
myenv/bin/python
Symbolic link
1
myenv/bin/python
Symbolic link
@@ -0,0 +1 @@
|
||||
python3
|
||||
78
myenv/bin/python-config
Executable file
78
myenv/bin/python-config
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/home/renjianbo/aitsc/myenv/bin/python
|
||||
|
||||
import sys
|
||||
import getopt
|
||||
import sysconfig
|
||||
|
||||
valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',
|
||||
'ldflags', 'help']
|
||||
|
||||
if sys.version_info >= (3, 2):
|
||||
valid_opts.insert(-1, 'extension-suffix')
|
||||
valid_opts.append('abiflags')
|
||||
if sys.version_info >= (3, 3):
|
||||
valid_opts.append('configdir')
|
||||
|
||||
|
||||
def exit_with_usage(code=1):
|
||||
sys.stderr.write("Usage: {0} [{1}]\n".format(
|
||||
sys.argv[0], '|'.join('--'+opt for opt in valid_opts)))
|
||||
sys.exit(code)
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], '', valid_opts)
|
||||
except getopt.error:
|
||||
exit_with_usage()
|
||||
|
||||
if not opts:
|
||||
exit_with_usage()
|
||||
|
||||
pyver = sysconfig.get_config_var('VERSION')
|
||||
getvar = sysconfig.get_config_var
|
||||
|
||||
opt_flags = [flag for (flag, val) in opts]
|
||||
|
||||
if '--help' in opt_flags:
|
||||
exit_with_usage(code=0)
|
||||
|
||||
for opt in opt_flags:
|
||||
if opt == '--prefix':
|
||||
print(sysconfig.get_config_var('prefix'))
|
||||
|
||||
elif opt == '--exec-prefix':
|
||||
print(sysconfig.get_config_var('exec_prefix'))
|
||||
|
||||
elif opt in ('--includes', '--cflags'):
|
||||
flags = ['-I' + sysconfig.get_path('include'),
|
||||
'-I' + sysconfig.get_path('platinclude')]
|
||||
if opt == '--cflags':
|
||||
flags.extend(getvar('CFLAGS').split())
|
||||
print(' '.join(flags))
|
||||
|
||||
elif opt in ('--libs', '--ldflags'):
|
||||
abiflags = getattr(sys, 'abiflags', '')
|
||||
libs = ['-lpython' + pyver + abiflags]
|
||||
libs += getvar('LIBS').split()
|
||||
libs += getvar('SYSLIBS').split()
|
||||
# add the prefix/lib/pythonX.Y/config dir, but only if there is no
|
||||
# shared library in prefix/lib/.
|
||||
if opt == '--ldflags':
|
||||
if not getvar('Py_ENABLE_SHARED'):
|
||||
libs.insert(0, '-L' + getvar('LIBPL'))
|
||||
if not getvar('PYTHONFRAMEWORK'):
|
||||
libs.extend(getvar('LINKFORSHARED').split())
|
||||
print(' '.join(libs))
|
||||
|
||||
elif opt == '--extension-suffix':
|
||||
ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')
|
||||
if ext_suffix is None:
|
||||
ext_suffix = sysconfig.get_config_var('SO')
|
||||
print(ext_suffix)
|
||||
|
||||
elif opt == '--abiflags':
|
||||
if not getattr(sys, 'abiflags', None):
|
||||
exit_with_usage()
|
||||
print(sys.abiflags)
|
||||
|
||||
elif opt == '--configdir':
|
||||
print(sysconfig.get_config_var('LIBPL'))
|
||||
BIN
myenv/bin/python3
Executable file
BIN
myenv/bin/python3
Executable file
Binary file not shown.
1
myenv/bin/python3.6
Symbolic link
1
myenv/bin/python3.6
Symbolic link
@@ -0,0 +1 @@
|
||||
python3
|
||||
11
myenv/bin/wheel
Executable file
11
myenv/bin/wheel
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/home/renjianbo/aitsc/myenv/bin/python3
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
|
||||
from wheel.tool import main
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
1
myenv/include/python3.6m
Symbolic link
1
myenv/include/python3.6m
Symbolic link
@@ -0,0 +1 @@
|
||||
/usr/include/python3.6m
|
||||
1
myenv/lib64
Symbolic link
1
myenv/lib64
Symbolic link
@@ -0,0 +1 @@
|
||||
lib
|
||||
1
myenv/pip-selfcheck.json
Normal file
1
myenv/pip-selfcheck.json
Normal file
@@ -0,0 +1 @@
|
||||
{"last_check":"2025-08-24T07:25:49Z","pypi_version":"25.2"}
|
||||
53
run_production_public.py
Normal file
53
run_production_public.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
生产环境启动脚本 - 支持外网访问
|
||||
使用 Flask 内置服务器,配置为生产模式
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from src.flask_prompt_master import create_app
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
# 设置生产环境变量
|
||||
os.environ['FLASK_ENV'] = 'production'
|
||||
|
||||
# 创建应用实例
|
||||
app = create_app()
|
||||
|
||||
# 获取端口号(支持环境变量配置)
|
||||
port = int(os.environ.get('PORT', 5001))
|
||||
|
||||
print("=" * 60)
|
||||
print("🚀 Flask 提示词大师 - 生产环境启动(外网访问)")
|
||||
print("=" * 60)
|
||||
print(f"📊 环境: {os.environ.get('FLASK_ENV', 'unknown')}")
|
||||
print(f"🌐 服务器: Flask 内置服务器")
|
||||
print(f"🔗 内网地址: http://10.0.4.13:{port}")
|
||||
print(f"🌍 外网地址: http://101.43.95.130:{port}")
|
||||
print(f"📝 日志: 控制台输出")
|
||||
print("=" * 60)
|
||||
print("✅ 服务器启动中...")
|
||||
print("💡 按 Ctrl+C 停止服务器")
|
||||
print("=" * 60)
|
||||
|
||||
try:
|
||||
# 启动 Flask 内置服务器(生产模式配置)
|
||||
app.run(
|
||||
host='0.0.0.0', # 监听所有网络接口
|
||||
port=port,
|
||||
debug=False, # 生产环境关闭调试
|
||||
threaded=True, # 启用多线程
|
||||
use_reloader=False # 关闭自动重载
|
||||
)
|
||||
except KeyboardInterrupt:
|
||||
print("\n" + "=" * 60)
|
||||
print("🛑 服务器已停止")
|
||||
print("=" * 60)
|
||||
except Exception as e:
|
||||
print(f"\n❌ 启动失败: {str(e)}")
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -22,7 +22,7 @@ def main():
|
||||
print("=" * 60)
|
||||
print(f"📊 环境: {os.environ.get('FLASK_ENV', 'unknown')}")
|
||||
print(f"🌐 服务器: Flask 内置服务器")
|
||||
print(f"🔗 地址: http://0.0.0.0:5000")
|
||||
print(f"🔗 地址: http://0.0.0.0:5001")
|
||||
print(f"📝 日志: 控制台输出")
|
||||
print("=" * 60)
|
||||
print("✅ 服务器启动中...")
|
||||
@@ -33,7 +33,7 @@ def main():
|
||||
# 启动 Flask 内置服务器(生产模式配置)
|
||||
app.run(
|
||||
host='0.0.0.0',
|
||||
port=5000,
|
||||
port=5001, # 修改端口为5001
|
||||
debug=False, # 生产环境关闭调试
|
||||
threaded=True, # 启用多线程
|
||||
use_reloader=False # 关闭自动重载
|
||||
|
||||
Reference in New Issue
Block a user