OK. we are getting closer if not already there. The cookiecutter distro 
which I am using does not have BASE_DIR defined at all, not in common.py or 
local.py

The directory structure they use is
repo_root/
  config/
    settings/
       common.py
       local.py
  manage.py


so BASE_DIR is actually 2 directories up from what you define it to be. The 
cookiecutter-django settings module has the following line ( which is the 
correct location, but the wrong name):

ROOT_DIR = environ.Path(__file__) - 3  # 
(guidewire/config/settings/common.py - 3 = guidewire/)

so an easy fix is to modify my common.py to:
 
ROOT_DIR = BASE_DIR = environ.Path(__file__) - 3  # 
(guidewire/config/settings/common.py - 3 = guidewire/)

except... if I do this I generate another error:

$ python manage.py runmodwsgi --log-to-terminal
Successfully ran command.
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File 
"/opt/Envs/guidewire/lib/python3.5/site-packages/django/core/management/__init__.py",
 
line 367, in execute_from_command_line
    utility.execute()
  File 
"/opt/Envs/guidewire/lib/python3.5/site-packages/django/core/management/__init__.py",
 
line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/opt/Envs/guidewire/lib/python3.5/site-packages/django/core/management/base.py",
 
line 305, in run_from_argv
    self.execute(*args, **cmd_options)
  File 
"/opt/Envs/guidewire/lib/python3.5/site-packages/django/core/management/base.py",
 
line 356, in execute
    output = self.handle(*args, **options)
  File 
"/opt/Envs/guidewire/lib/python3.5/site-packages/mod_wsgi/server/management/commands/runmodwsgi.py",
 
line 106, in handle
    'start-server', args, options)
  File 
"/opt/Envs/guidewire/lib/python3.5/site-packages/mod_wsgi/server/__init__.py", 
line 2533, in _cmd_setup_server
    options['working_directory'] = 
os.path.abspath(options['working_directory'])
  File "/opt/Envs/guidewire/lib/python3.5/posixpath.py", line 357, in 
abspath
    if not isabs(path):
  File "/opt/Envs/guidewire/lib/python3.5/posixpath.py", line 64, in isabs
    return s.startswith(sep)
AttributeError: 'Path' object has no attribute 'startswith'

But, if instead I hardcode BASE_DIR to the correct path, runmodwsgi runs 
and serves my django site!!!

So the issue with the error thrown above is that the django settings module 
that cookiecutter provides uses the django-environ project, so environ.Path 
is in fact an environ.environ.Path object, not a string. so the string 
methods in os.path fail...

It's an easy enough fix
BASE_DIR = ROOT_DIR.root

and I don't believe this is mod_wsgi's problem, but rather my own. 

I'll probably bring this up in the cookiecutter-django community.

Thanks for all your help. I'm now up and running.

Danny



-- 
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.

Reply via email to