index.wsgi没有在root中找到virtualenv(index.wsgi not finding virtualenv in root)
我正在尝试按照本教程在Apache VPS上安装django站点
我的index.wsgi应该在root中激活virtualenv,它看起来像这样:import os import sys import site # Add the site-packages of the chosen virtualenv to work with site.addsitedir('~/.virtualenvs/DBENV/local/lib/python2.7/site-packages') # Add the app's directory to the PYTHONPATH sys.path.append('/home/DB2015/') sys.path.append('/home/DB2015/davidcms/') os.environ['DJANGO_SETTINGS_MODULE'] = 'davidcms.settings' # Activate your virtual env activate_env=os.path.expanduser("~/.virtualenvs/DBENV/bin/activate_this.py") execfile(activate_env, dict(__file__=activate_env)) import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
我收到这个错误
[Tue Feb 17 07:13:30.701511 2015] [:error] [pid 16103:tid 140396130674432] [client 217.44.75.146:58169] execfile(activate_env, dict(__file__=activate_env)) [Tue Feb 17 07:13:30.701653 2015] [:error] [pid 16103:tid 140396130674432] [client 217.44.75.146:58169] IOError: [Errno 2] No such file or directory: '/var/www/.virtualenvs/DBENV/bin/activate_this.py'
所以它在
var/www/
而不是root中查找。 当我尝试将os.path.expanduser
更改为根目录中的.virtualenvs路径时:# Activate your virtual env activate_env= "~/.virtualenvs/DBENV/bin/activate_this.py" execfile(activate_env, dict(__file__=activate_env))
它仍然说
[Tue Feb 17 07:17:12.019641 2015] [:error] [pid 16104:tid 140396206208768] [client 217.44.75.146:58200] execfile(activate_env, dict(__file__=activate_env)) [Tue Feb 17 07:17:12.019852 2015] [:error] [pid 16104:tid 140396206208768] [client 217.44.75.146:58200] IOError: [Errno 2] No such file or directory: '~/.virtualenvs/DBENV/bin/activate_this.py'
我错过了什么?!
I am trying to install a django site on an Apache VPS, following this tutorial
my index.wsgi should activate a virtualenv in the root, it looks like this:import os import sys import site # Add the site-packages of the chosen virtualenv to work with site.addsitedir('~/.virtualenvs/DBENV/local/lib/python2.7/site-packages') # Add the app's directory to the PYTHONPATH sys.path.append('/home/DB2015/') sys.path.append('/home/DB2015/davidcms/') os.environ['DJANGO_SETTINGS_MODULE'] = 'davidcms.settings' # Activate your virtual env activate_env=os.path.expanduser("~/.virtualenvs/DBENV/bin/activate_this.py") execfile(activate_env, dict(__file__=activate_env)) import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
and I get this error
[Tue Feb 17 07:13:30.701511 2015] [:error] [pid 16103:tid 140396130674432] [client 217.44.75.146:58169] execfile(activate_env, dict(__file__=activate_env)) [Tue Feb 17 07:13:30.701653 2015] [:error] [pid 16103:tid 140396130674432] [client 217.44.75.146:58169] IOError: [Errno 2] No such file or directory: '/var/www/.virtualenvs/DBENV/bin/activate_this.py'
So its looking in
var/www/
instead of the root. When I try to changeos.path.expanduser
to just the path to .virtualenvs in the root as such:# Activate your virtual env activate_env= "~/.virtualenvs/DBENV/bin/activate_this.py" execfile(activate_env, dict(__file__=activate_env))
it still says
[Tue Feb 17 07:17:12.019641 2015] [:error] [pid 16104:tid 140396206208768] [client 217.44.75.146:58200] execfile(activate_env, dict(__file__=activate_env)) [Tue Feb 17 07:17:12.019852 2015] [:error] [pid 16104:tid 140396206208768] [client 217.44.75.146:58200] IOError: [Errno 2] No such file or directory: '~/.virtualenvs/DBENV/bin/activate_this.py'
What am I missing?!
原文:https://stackoverflow.com/questions/28561390
最满意答案
以下是http://gruntjs.com/creating-tasks的示例
任务可以是异步的。
grunt.registerTask('asyncfoo', 'My "asyncfoo" task.', function() { // Force task into async mode and grab a handle to the "done" function. var done = this.async(); // Run some sync stuff. grunt.log.writeln('Processing task...'); // And some async stuff. setTimeout(function() { grunt.log.writeln('All done!'); done(); }, 1000); });
Here is an example from http://gruntjs.com/creating-tasks
Tasks can be asynchronous.
grunt.registerTask('asyncfoo', 'My "asyncfoo" task.', function() { // Force task into async mode and grab a handle to the "done" function. var done = this.async(); // Run some sync stuff. grunt.log.writeln('Processing task...'); // And some async stuff. setTimeout(function() { grunt.log.writeln('All done!'); done(); }, 1000); });
相关问答
更多-
grunt.initConfig({ clean: {/!* clean task configuration *!/}, copy: {/!* copy task configuration *!/}, compass: {/!* compass task configuration *!/}, cssmin: {/!* cssmin task configuration *!/} }); grunt.registerTask('theme', function () { ...
-
运行任务时出现咕噜声(grunt error while running task)[2022-04-13]
我遵循了MikeC的建议并将grunt-notify包更新到了0.4.5版,现在它就像一个魅力一样工作! I followed MikeC advice and updated the grunt-notify package to version 0.4.5 and now it is working like a charm! -
保持任务咕噜声任务打开(Keep a task grunt task open)[2023-11-15]
以下是http://gruntjs.com/creating-tasks的示例 任务可以是异步的。 grunt.registerTask('asyncfoo', 'My "asyncfoo" task.', function() { // Force task into async mode and grab a handle to the "done" function. var done = this.async(); // Run some sync stuff. gr ... -
任务连接未找到咕噜声(Task connect not found grunt)[2024-01-13]
您需要单独调用loadNpmTasks : grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-connect'); 您只能使用loadNpmTasks一次加载一个插件。 You need to make separate calls to loadNpmTasks: grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt- ... -
Grunt只运行默认任务(Grunt only runs default task)[2023-11-04]
后: 删除和克隆回购。 删除npm_modules。 重新安装一切。 创建一个独立的项目来测试此问题。 由于@XavierPriour的评论,我们检查了咕噜咕噜的路径 在iTerm中使用zsh: ➜ folder git:(branch) which grunt /usr/local/bin/grunt ➜ folder git:(branch) type -a grunt grunt is /usr/local/bin/grunt grunt is /usr/bin/grunt 我们删除了额外的gr ... -
显然,这篇文章: Grunt LiveReload真的很慢,讨论同样的问题,我相信它解决了它。 如果有帮助的话,我还要尝试一下并更新这篇文章。 Apparently, this post: Grunt LiveReload is really slow discusses the same problem and I believe it solves it. I'm yet to try it out and update this post if it helps.
-
咕噜声的问题(Problems with grunt)[2019-10-01]
因此,您实际上从未运行browserify任务。 当您在命令行上运行grunt而未指定特定任务时,它会运行default任务,在这种情况下只运行connect和watch 。 有两种方法可以解决: 只需在命令行上调用grunt browserify即可 将默认任务更改为: ['browserify', 'connect', 'watch'] So, you are never actually running the browserify task. When you run grunt on the co ... -
无法使用grunt-bower-task插件运行我的grunt任务(Can't run my grunt task using grunt-bower-task plugin)[2023-02-09]
你试过从命令提示符运行bower安装吗? 你是如何生成项目支架的? Bower.json,package.json和gruntfile.js应该在你的根目录中。 这是生成项目支架并使用grunt和bower运行应用程序的最佳方法。 http://yeoman.io/codelab/setup.html 我希望这能帮到您。 did you tried running bower install from command prompt? How did you generated your project sc ... -
在第22行, https://github.com/gruntjs/grunt/blob/master/lib/grunt/fail.js,您可以找到“哔”行的示例。 如果你对嘟嘟声感到恼火,想要消除周围的所有哔哔声,那就试着把它放在一边 grunt.option('no-color',true) 在你的gruntfile中,所以该行 if(!grunt.option('no-color')){msg + ='\ x07'; } 永远不会发生。 On line 22, https://github.com/ ...
-
这只是我们所拥有的文件夹的命名约定 dist是存储生成的档案的文件夹(因此它通过清理和构建进行更新)。 build文件夹包含已编译的类和资源,但不包含压缩的存档。 It's just a naming conventions for folders like in java we have dist is the folder where your generated archives are stored (so it gets updated through clean and build). buil ...