Home
Sign Up
Sign In
推荐学习书目
›
Learn Python the Hard Way
Python Sites
›
PyPI
- Python Package Index
›
http://diveintopython.org/toc/index.html
›
Pocoo
值得关注的项目
›
PyPy
›
Celery
›
Jinja2
›
Read the Docs
›
gevent
›
pyenv
›
virtualenv
›
Stackless Python
›
Beautiful Soup
›
结巴中文分词
›
Green Unicorn
›
Sentry
›
Shovel
›
Pyflakes
›
pytest
Python 编程
›
pep8 Checker
Styles
›
PEP 8
›
Google Python Style Guide
›
Code Style from The Hitchhiker's Guide
V2EX
›
Python
怎么在使用 wsgi 时导入自定义的模块
zeyexe
·
Dec 22, 2011
· 5593 views
This topic created in 5431 days ago, the information mentioned may be changed or developed.
我在 apache + wsgi 中要导入一个自己写的模块,把模块放到 c:\python\lib 目录下,import mymodule 可以正常工作,但是把它放到工程目录 d:\project\ 下则出现 500 Internal Server Error。如果我想把模块放到工程目录下,而又不想把工程目录加到系统路径,请问应该怎么写 import?
模块
目录
wsgi
4 replies
•
1970-01-01 08:00:00 +08:00
keakon
Dec 22, 2011
1
把想要的路径加入sys.path试试
zeyexe
OP
Dec 22, 2011
2
@
keakon
这样可以用,只是代码变成了
import sys
sys.path.append('D:/project/')
import module
好像不太整齐
ry_wang
Jan 9, 2012
3
如果用的mod_wsgi的话,请查询WSGIPythonPath参数用法
如果用的uWSGI的话,请查询pythonpath参数用法
lepture
Jan 9, 2012
4
python2.7+ 建议使用 site
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
1466 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 23ms ·
UTC 23:00
·
PVG 07:00
·
LAX 15:00
·
JFK 18:00
♥ Do have faith in what you're doing.
❯