- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
所以我一直在摸索一段时间试图弄清楚这一点。我在 Ubuntu 16.04 上,有 2 个不同的 django 项目。此处的目的是使用“sites-(enabled|available)”文件夹中的两个不同文件在同一服务器上的两个单独域上并排运行两者。一个工作正常(并且已经有一段时间了,第二个站点是新站点)。第二个不是。我猜这与我的 wsgi 设置有关。为了使事情复杂化,我也使用了lets-encrypt。我确信这不是问题,但我会发布他们的 confs 以确保。
项目一位于目录 /home/arlyon/arlyon
nr2 在目录 /home/arlyon/threeswords
中.
000-default.conf
<VirtualHost *:80>
ServerName www.site1.com
ServerAlias site1.com
ServerAdmin mail@me.com
DocumentRoot /home/arlyon/arlyon
WSGIScriptAlias / /home/arlyon/arlyon/arlyon/apache/wsgi.py
WSGIDaemonProcess arlyon python-home=/home/arlyon/arlyon/venv python-path=/home/arlyon/arlyon
WSGIProcessGroup arlyon
Alias /static/ /home/arlyon/arlyon/static/
<Directory /home/arlyon/arlyon/static>
Require all granted
</Directory>
Alias /media/ /home/arlyon/arlyon/media/
<Directory /home/arlyon/arlyon/media>
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.site1.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName www.site1.com
ServerAlias site1.com
ServerAdmin mail@me.com
DocumentRoot /home/arlyon/arlyon
# user/project/projectapp
# project and home dir are the same
WSGIScriptAlias / /home/arlyon/arlyon/arlyon/apache/wsgi.py
Alias /static/ /home/arlyon/arlyon/static/
<Directory /home/arlyon/arlyon/static>
Require all granted
</Directory>
Alias /media/ /home/arlyon/arlyon/media/
<Directory /home/arlyon/arlyon/media>
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLCertificateFile /etc/letsencrypt/live/www.site1.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.site1.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
<VirtualHost *:80>
ServerName www.site2.com
ServerAlias *.site2.com
ServerAdmin mail@me.com
DocumentRoot /home/arlyon/threeswords
WSGIScriptAlias / /home/arlyon/threeswords/threeswords/wsgi.py
WSGIDaemonProcess threeswords python-path=/home/arlyon/threeswords python-home=/home/arlyon/threeswords/venv
WSGIProcessGroup threeswords
<Directory "/home/arlyon/threeswords/threeswords/">
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /static/ /home/arlyon/threeswords/static/
<Directory /home/arlyon/threeswords/static>
Require all granted
</Directory>
Alias /media/ /home/arlyon/threeswords/media/
<Directory /home/arlyon/threeswords/media>
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/ts_error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.site2.no [OR]
RewriteCond %{SERVER_NAME} =*.site2.no
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName www.site2.no
ServerAlias *.site2.no
ServerAdmin arlyon@me.com
DocumentRoot /home/arlyon/threeswords
WSGIScriptAlias / /home/arlyon/threeswords/threeswords/wsgi.py
Alias /static/ /home/arlyon/threeswords/static/
<Directory /home/arlyon/threeswords/static>
Require all granted
</Directory>
Alias /media/ /home/arlyon/threeswords/media/
<Directory /home/arlyon/threeswords/media>
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/ts_error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.site2.no
# Some rewrite rules in this file were were disabled on your HTTPS site,
# because they have the potential to create redirection loops.
# RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
SSLCertificateFile /etc/letsencrypt/live/www.site1.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.site1.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
from __future__ import absolute_import, unicode_literals
import site
import os
from django.core.wsgi import get_wsgi_application
site.addsitedir('/home/arlyon/threeswords/venv/lib/python3.5/site-packages')
os.environ["DJANGO_SETTINGS_MODULE"] = "threeswords.settings.dev"
application = get_wsgi_application()
[Mon Nov 07 23:27:29.484760 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] mod_wsgi (pid=30535): Target WSGI script '/home/arlyon/threeswords/threeswords/wsgi.py' cannot be loaded as Python module.
[Mon Nov 07 23:27:29.484844 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] mod_wsgi (pid=30535): Exception occurred processing WSGI script '/home/arlyon/threeswords/threeswords/wsgi.py'.
[Mon Nov 07 23:27:29.485206 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] Traceback (most recent call last):
[Mon Nov 07 23:27:29.485321 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "/home/arlyon/threeswords/threeswords/wsgi.py", line 19, in <module>
[Mon Nov 07 23:27:29.485349 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] application = get_wsgi_application()
[Mon Nov 07 23:27:29.485369 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "/usr/local/lib/python3.5/dist-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Mon Nov 07 23:27:29.485379 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] django.setup()
[Mon Nov 07 23:27:29.485397 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "/usr/local/lib/python3.5/dist-packages/django/__init__.py", line 17, in setup
[Mon Nov 07 23:27:29.485407 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Mon Nov 07 23:27:29.485425 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 55, in __getattr__
[Mon Nov 07 23:27:29.485435 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] self._setup(name)
[Mon Nov 07 23:27:29.485452 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 43, in _setup
[Mon Nov 07 23:27:29.485462 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] self._wrapped = Settings(settings_module)
[Mon Nov 07 23:27:29.485480 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 99, in __init__
[Mon Nov 07 23:27:29.485489 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] mod = importlib.import_module(self.SETTINGS_MODULE)
[Mon Nov 07 23:27:29.485507 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
[Mon Nov 07 23:27:29.485517 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] return _bootstrap._gcd_import(name[level:], package, level)
[Mon Nov 07 23:27:29.485534 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "<frozen importlib._bootstrap>", line 986, in _gcd_import
[Mon Nov 07 23:27:29.485554 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "<frozen importlib._bootstrap>", line 969, in _find_and_load
[Mon Nov 07 23:27:29.485573 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked
[Mon Nov 07 23:27:29.485592 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
[Mon Nov 07 23:27:29.485612 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "<frozen importlib._bootstrap>", line 986, in _gcd_import
[Mon Nov 07 23:27:29.485631 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "<frozen importlib._bootstrap>", line 969, in _find_and_load
[Mon Nov 07 23:27:29.485650 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked
[Mon Nov 07 23:27:29.485669 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
[Mon Nov 07 23:27:29.485688 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "<frozen importlib._bootstrap>", line 986, in _gcd_import
[Mon Nov 07 23:27:29.485707 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "<frozen importlib._bootstrap>", line 969, in _find_and_load
[Mon Nov 07 23:27:29.485736 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
[Mon Nov 07 23:27:29.485774 2016] [wsgi:error] [pid 30535:tid 140472987141888] [client 92.221.32.65:56377] ImportError: No module named 'threeswords'
[Mon Nov 07 23:27:29.700491 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] mod_wsgi (pid=30535): Target WSGI script '/home/arlyon/threeswords/threeswords/wsgi.py' cannot be loaded as Python module., referer: https://www.site2.no/
[Mon Nov 07 23:27:29.700569 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] mod_wsgi (pid=30535): Exception occurred processing WSGI script '/home/arlyon/threeswords/threeswords/wsgi.py'., referer: https://www.site2.com/
[Mon Nov 07 23:27:29.700934 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] Traceback (most recent call last):, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701050 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "/home/arlyon/threeswords/threeswords/wsgi.py", line 19, in <module>, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701061 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] application = get_wsgi_application(), referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701081 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "/usr/local/lib/python3.5/dist-packages/django/core/wsgi.py", line 13, in get_wsgi_application, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701091 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] django.setup(), referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701110 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "/usr/local/lib/python3.5/dist-packages/django/__init__.py", line 17, in setup, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701120 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING), referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701139 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 55, in __getattr__, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701149 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] self._setup(name), referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701183 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 43, in _setup, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701193 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] self._wrapped = Settings(settings_module), referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701212 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 99, in __init__, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701222 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] mod = importlib.import_module(self.SETTINGS_MODULE), referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701240 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701250 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] return _bootstrap._gcd_import(name[level:], package, level), referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701285 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "<frozen importlib._bootstrap>", line 986, in _gcd_import, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701306 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "<frozen importlib._bootstrap>", line 969, in _find_and_load, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701326 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701346 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701366 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "<frozen importlib._bootstrap>", line 986, in _gcd_import, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701386 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "<frozen importlib._bootstrap>", line 969, in _find_and_load, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701405 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701425 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701445 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "<frozen importlib._bootstrap>", line 986, in _gcd_import, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701465 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "<frozen importlib._bootstrap>", line 969, in _find_and_load, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701484 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked, referer: https://www.site2.com/
[Mon Nov 07 23:27:29.701523 2016] [wsgi:error] [pid 30535:tid 140472978749184] [client 92.221.32.65:56378] ImportError: No module named 'threeswords', referer: https://www.site2.com/
最佳答案
你不见了WSGIProcessGroup
443 VirtualHost
中的指令条目。对于这两个请求都没有被委派给正确的 mod_wsgi 守护进程组。由于 Python 模块搜索路径被设置为守护进程组定义的一部分,因此它将无法找到您的应用程序代码。
关于Django mod_wsgi : ImportError: No module named '$myproject' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40475953/
我按照 Google Sign-in for iOS 上的所有说明进行操作使用CocoaPods(尽管我以前没有使用过CocoaPods,但仍然不明白它是什么),当我运行程序时,我收到此错误: bri
我目前正在使用 Android Studio 并尝试进行重建,但出现以下错误。 Gradle: FAILURE: Build failed with an exception. * What went
是否可以在同一域中的 2 个不同 url 上保持相同的 jsessionid? 示例: 我在我的网站 (http://MyProject.com) 的主页上。当我点击一个按钮时,我被重定向到“http
我已经多次看到这种包结构模式。最近,我浏览了 Last.fm Android 应用程序代码,想了解为什么有些代码在 fm.last.api 和 fm.last.api.impl 中。 https://
直到现在我在 jboss-4.2.2.GA 和 windows7 中运行 war 文件 在 server/default/deploye 中部署了 myproject.war 和 myproject-
我最近开始对 native 使用react,并遵循教程指南 2 选项一是通过“create-react-native-app myproject”创建项目,另一个是“react-native init
当我将代码从我的笔记本电脑移到我的 Mac Mini 并在那里打开它时,我收到以下错误消息: myProject is locked for editing and you may not be ab
我有一个包含文件 myproject.module 的 C 项目。它看起来像某种构建/制作文件。我想知道哪个工具链可以解释这个文件并构建项目。 文件看起来像这样: % comments look li
我正在使用 asp.net core 3.1 项目模板开发 Web API。没有编译错误。 这是我的代码详情: Program.cs public class Program { public
我不确定发生了什么,但现在我刚刚为我的 mvc 网站上传了一个新的 dll,并且收到以下错误 Parser Error Message: Could not load type 'MyProject.
我有一个文件夹,里面有我的工作 xcode 项目。但是,当我将整个文件夹复制并粘贴到其他位置,然后打开其中的 .xcodeproj 文件时,我收到一条错误消息,指出该项目不存在! 有谁知道为什么要这样
我正在尝试将图像添加到按钮(C# Winform、VS2010)。我已通过在 Resources.resx 文件中添加现有项目来添加资源。然后我将我的图像分配给按钮,一切都很好。当我运行我的程序时,我
我用 MonoDevelop 构建了一个简单的 ASP.NET MVC 2 项目,当它在 MonoDevelop 的调试服务器上运行时就可以了。 然后我在 http://go-mono.com/con
让我们考虑这样的目录结构: C:\Tests>tree /F C:. │ GreetingsUniverse.java │ └───planets Earth.java
如何在我的项目中设置一个 .npmrc 文件来定义我自己的私有(private)注册表?我不想在我的用户配置 .npmrc 中有这种配置。每个其他开发人员都应该能够只 git clone 项目并运行
我正在新服务器上安装以前构建的网站。我不是最初的开发者。 我过去曾使用 Gunicorn + nginx 来保持应用程序的运行(基本上遵循 this tutorial ),但在这里遇到了问题。 我 s
一旦我将资源添加到我的项目中,所有包含“Properties.Resources”的代码引用都被标记为错误,告诉我“命名空间‘MyProject 中不存在类型或命名空间名称‘Resources’。属性
我已按照 channel 2 教程进行操作,但在运行 py manage.py runserver 后出现此错误 File "C:\Users\Mach2\AppData\Local\Programs
从 Eclipse 升级到 Android Studio 后,我想更新我的 TouchDB 库,现在是 Coubasebase-lite-android .我从我的项目中删除了 TouchDB,通过文
我正在尝试重建 Hibernate 配置,但出现错误的编译器设置错误,请在下面找到我的应用程序配置和错误的屏幕截图: 最佳答案 问题是因为 Eclipse 运行在与我的项目中指定的 JVM 不同的 J
我是一名优秀的程序员,十分优秀!