I ran the pip install from your dev again, and I'm not sure anything
changed.
First, I checked my postactivate script, and I have:
export DJANGO_SETTINGS_MODULE='config.settings.local'
as well as proxy settings and the DATABASE_URL
my config/settings/common.py has:
WSGI_APPLICATION = 'config.wsgi.application'
it is not overridden in config/settings/local.py.
My config/wsgi.py file is straight from cookiecutter.
###############################################
import os
from django.core.wsgi import get_wsgi_application
if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production':
from raven.contrib.django.raven_compat.middleware.wsgi import Sentry
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This
breaks
# if running multiple sites in the same mod_wsgi process. To fix this, use
# mod_wsgi daemon mode with each site in its own daemon process, or use
# os.environ["DJANGO_SETTINGS_MODULE"] = "config.settings.production"
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"config.settings.production")
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
application = get_wsgi_application()
if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production':
application = Sentry(application)
######################################################
since postactivate sets:
export DJANGO_SETTINGS_MODULE='config.settings.local'
almost none of wsgi.py gets executed, just
application = get_wsgi_application()
finally
$ mod_wsgi-express start-server --log-to-terminal --url-alias /static
staticfiles --application-type module config.wsgi
works just fine, but leaving out all the arguments as I now believe is
correct to do, I get
$ python manage.py runmodwsgi --log-to-terminal
Successfully ran command.
Server URL : http://localhost:8000/
Server Root : /tmp/mod_wsgi-localhost:8000:501
Server Conf : /tmp/mod_wsgi-localhost:8000:501/httpd.conf
Error Log File : /dev/stderr (warn)
Request Capacity : 5 (1 process * 5 threads)
Request Timeout : 60 (seconds)
Startup Timeout : 15 (seconds)
Queue Backlog : 100 (connections)
Queue Timeout : 45 (seconds)
Server Capacity : 20 (event/worker), 20 (prefork)
Server Backlog : 500 (connections)
Locale Setting : en_US.UTF-8
[Tue Aug 23 14:32:02.741901 2016] [mpm_event:notice] [pid 598:tid
140065312126720] AH00489: Apache/2.4.12 (Unix) mod_wsgi/4.5.6 Python/3.5.2
configured -- resuming normal operations
[Tue Aug 23 14:32:02.742045 2016] [core:notice] [pid 598:tid
140065312126720] AH00094: Command line: 'httpd (mod_wsgi-express) -f
/tmp/mod_wsgi-localhost:8000:501/httpd.conf -D
MOD_WSGI_MPM_ENABLE_EVENT_MODULE -D MOD_WSGI_MPM_EXISTS_EVENT_MODULE -D
MOD_WSGI_MPM_EXISTS_WORKER_MODULE -D MOD_WSGI_MPM_EXISTS_PREFORK_MODULE -D
FOREGROUND'
[Tue Aug 23 14:32:03.126267 2016] [wsgi:error] [pid 602:tid
140065312126720] mod_wsgi (pid=602): Target WSGI script
'/tmp/mod_wsgi-localhost:8000:501/handler.wsgi' cannot be loaded as Python
module.
[Tue Aug 23 14:32:03.126402 2016] [wsgi:error] [pid 602:tid
140065312126720] mod_wsgi (pid=602): Exception occurred processing WSGI
script '/tmp/mod_wsgi-localhost:8000:501/handler.wsgi'.
[Tue Aug 23 14:32:03.129097 2016] [wsgi:error] [pid 602:tid
140065312126720] Traceback (most recent call last):
[Tue Aug 23 14:32:03.129202 2016] [wsgi:error] [pid 602:tid
140065312126720] File "/tmp/mod_wsgi-localhost:8000:501/handler.wsgi",
line 94, in <module>
[Tue Aug 23 14:32:03.129212 2016] [wsgi:error] [pid 602:tid
140065312126720] recorder_directory=recorder_directory)
[Tue Aug 23 14:32:03.129225 2016] [wsgi:error] [pid 602:tid
140065312126720] File
"/opt/Envs/guidewire/lib/python3.5/site-packages/mod_wsgi/server/__init__.py",
line 1348, in __init__
[Tue Aug 23 14:32:03.129232 2016] [wsgi:error] [pid 602:tid
140065312126720] exec(code, self.module.__dict__)
[Tue Aug 23 14:32:03.129243 2016] [wsgi:error] [pid 602:tid
140065312126720] File "/opt/Projects/guidewire/config/wsgi.py", line 31,
in <module>
[Tue Aug 23 14:32:03.129249 2016] [wsgi:error] [pid 602:tid
140065312126720] application = get_wsgi_application()
[Tue Aug 23 14:32:03.129260 2016] [wsgi:error] [pid 602:tid
140065312126720] File
"/opt/Envs/guidewire/lib/python3.5/site-packages/django/core/wsgi.py", line
13, in get_wsgi_application
[Tue Aug 23 14:32:03.129267 2016] [wsgi:error] [pid 602:tid
140065312126720] django.setup(set_prefix=False)
[Tue Aug 23 14:32:03.129277 2016] [wsgi:error] [pid 602:tid
140065312126720] File
"/opt/Envs/guidewire/lib/python3.5/site-packages/django/__init__.py", line
22, in setup
[Tue Aug 23 14:32:03.129284 2016] [wsgi:error] [pid 602:tid
140065312126720] configure_logging(settings.LOGGING_CONFIG,
settings.LOGGING)
[Tue Aug 23 14:32:03.129295 2016] [wsgi:error] [pid 602:tid
140065312126720] File
"/opt/Envs/guidewire/lib/python3.5/site-packages/django/conf/__init__.py",
line 53, in __getattr__
[Tue Aug 23 14:32:03.129301 2016] [wsgi:error] [pid 602:tid
140065312126720] self._setup(name)
[Tue Aug 23 14:32:03.129312 2016] [wsgi:error] [pid 602:tid
140065312126720] File
"/opt/Envs/guidewire/lib/python3.5/site-packages/django/conf/__init__.py",
line 41, in _setup
[Tue Aug 23 14:32:03.129319 2016] [wsgi:error] [pid 602:tid
140065312126720] self._wrapped = Settings(settings_module)
[Tue Aug 23 14:32:03.129329 2016] [wsgi:error] [pid 602:tid
140065312126720] File
"/opt/Envs/guidewire/lib/python3.5/site-packages/django/conf/__init__.py",
line 97, in __init__
[Tue Aug 23 14:32:03.129336 2016] [wsgi:error] [pid 602:tid
140065312126720] mod = importlib.import_module(self.SETTINGS_MODULE)
[Tue Aug 23 14:32:03.129347 2016] [wsgi:error] [pid 602:tid
140065312126720] File
"/opt/Envs/guidewire/lib/python3.5/importlib/__init__.py", line 126, in
import_module
[Tue Aug 23 14:32:03.129353 2016] [wsgi:error] [pid 602:tid
140065312126720] return _bootstrap._gcd_import(name[level:], package,
level)
[Tue Aug 23 14:32:03.129364 2016] [wsgi:error] [pid 602:tid
140065312126720] File "<frozen importlib._bootstrap>", line 986, in
_gcd_import
[Tue Aug 23 14:32:03.129377 2016] [wsgi:error] [pid 602:tid
140065312126720] File "<frozen importlib._bootstrap>", line 969, in
_find_and_load
[Tue Aug 23 14:32:03.129389 2016] [wsgi:error] [pid 602:tid
140065312126720] File "<frozen importlib._bootstrap>", line 944, in
_find_and_load_unlocked
[Tue Aug 23 14:32:03.129401 2016] [wsgi:error] [pid 602:tid
140065312126720] File "<frozen importlib._bootstrap>", line 222, in
_call_with_frames_removed
[Tue Aug 23 14:32:03.129414 2016] [wsgi:error] [pid 602:tid
140065312126720] File "<frozen importlib._bootstrap>", line 986, in
_gcd_import
[Tue Aug 23 14:32:03.129426 2016] [wsgi:error] [pid 602:tid
140065312126720] File "<frozen importlib._bootstrap>", line 969, in
_find_and_load
[Tue Aug 23 14:32:03.129438 2016] [wsgi:error] [pid 602:tid
140065312126720] File "<frozen importlib._bootstrap>", line 944, in
_find_and_load_unlocked
[Tue Aug 23 14:32:03.129450 2016] [wsgi:error] [pid 602:tid
140065312126720] File "<frozen importlib._bootstrap>", line 222, in
_call_with_frames_removed
[Tue Aug 23 14:32:03.129462 2016] [wsgi:error] [pid 602:tid
140065312126720] File "<frozen importlib._bootstrap>", line 986, in
_gcd_import
[Tue Aug 23 14:32:03.129475 2016] [wsgi:error] [pid 602:tid
140065312126720] File "<frozen importlib._bootstrap>", line 969, in
_find_and_load
[Tue Aug 23 14:32:03.129487 2016] [wsgi:error] [pid 602:tid
140065312126720] File "<frozen importlib._bootstrap>", line 956, in
_find_and_load_unlocked
[Tue Aug 23 14:32:03.129522 2016] [wsgi:error] [pid 602:tid
140065312126720] ImportError: No module named 'config'
finally I don't know if it helps, but I'm including the contents of
/tmp/mod_wsgi-localhost:8000:501/handler.wsgi
##########################3
import os
import sys
import atexit
import time
import mod_wsgi.server
working_directory = '/opt/Projects/guidewire/config'
entry_point = '/opt/Projects/guidewire/config/wsgi.py'
application_type = 'script'
callable_object = 'application'
mount_point = '/'
with_newrelic_agent = False
newrelic_config_file = ''
newrelic_environment = ''
reload_on_changes = False
debug_mode = False
enable_debugger = False
debugger_startup = False
enable_coverage = False
coverage_directory = ''
enable_profiler = False
profiler_directory = ''
enable_recorder = False
recorder_directory = ''
enable_gdb = False
os.environ['MOD_WSGI_EXPRESS'] = 'true'
os.environ['MOD_WSGI_SERVER_NAME'] = 'localhost'
os.environ['MOD_WSGI_SERVER_ALIASES'] = None or ''
if reload_on_changes:
os.environ['MOD_WSGI_RELOADER_ENABLED'] = 'true'
if debug_mode:
os.environ['MOD_WSGI_DEBUG_MODE'] = 'true'
# We need to fiddle sys.path as we are not using daemon mode and so
# the working directory will not be added to sys.path by virtue of
# 'home' option to WSGIDaemonProcess directive. We could use the
# WSGIPythonPath directive, but that will cause .pth files to also
# be evaluated.
sys.path.insert(0, working_directory)
if enable_debugger:
os.environ['MOD_WSGI_DEBUGGER_ENABLED'] = 'true'
def output_coverage_report():
coverage_info.stop()
coverage_info.html_report(directory=coverage_directory)
if enable_coverage:
os.environ['MOD_WSGI_COVERAGE_ENABLED'] = 'true'
from coverage import coverage
coverage_info = coverage()
coverage_info.start()
atexit.register(output_coverage_report)
def output_profiler_data():
profiler_info.disable()
output_file = '%s-%d.pstats' % (int(time.time()*1000000), os.getpid())
output_file = os.path.join(profiler_directory, output_file)
profiler_info.dump_stats(output_file)
if enable_profiler:
os.environ['MOD_WSGI_PROFILER_ENABLED'] = 'true'
from cProfile import Profile
profiler_info = Profile()
profiler_info.enable()
atexit.register(output_profiler_data)
if enable_recorder:
os.environ['MOD_WSGI_RECORDER_ENABLED'] = 'true'
if enable_gdb:
os.environ['MOD_WSGI_GDB_ENABLED'] = 'true'
if with_newrelic_agent:
if newrelic_config_file:
os.environ['NEW_RELIC_CONFIG_FILE'] = newrelic_config_file
if newrelic_environment:
os.environ['NEW_RELIC_ENVIRONMENT'] = newrelic_environment
handler = mod_wsgi.server.ApplicationHandler(entry_point,
application_type=application_type, callable_object=callable_object,
mount_point=mount_point, with_newrelic_agent=with_newrelic_agent,
debug_mode=debug_mode, enable_debugger=enable_debugger,
debugger_startup=debugger_startup, enable_recorder=enable_recorder,
recorder_directory=recorder_directory)
reload_required = handler.reload_required
handle_request = handler.handle_request
if reload_on_changes and not debug_mode:
mod_wsgi.server.start_reloader()
################################################################################
one final thing is that I don't see a version bump in the pip install:$ pip
install -U https://github.com/GrahamDumpleton/mod_wsgi/archive/develop.zip
Collecting https://github.com/GrahamDumpleton/mod_wsgi/archive/develop.zip
Downloading
https://github.com/GrahamDumpleton/mod_wsgi/archive/develop.zip
/ 778kB 15.2MB/s
Installing collected packages: mod-wsgi
Found existing installation: mod-wsgi 4.5.6
Uninstalling mod-wsgi-4.5.6:
Successfully uninstalled mod-wsgi-4.5.6
Running setup.py install for mod-wsgi ... done
Successfully installed mod-wsgi-4.5.6
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.