Opened 4 years ago

Closed 3 years ago

#15058 closed Bug (wontfix)

sys.path.append()

Reported by: daghenrik Owned by: nobody
Component: Documentation Version: 1.2
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I was struggling with getting WSGI up until I found the following:

If you have been using the Django development server and have made use of the fact that it is possible when doing explicit imports, or when referencing modules in 'urls.py', to leave out the name of the site and use a relative module path, you will also need to add to sys.path the path to the site package directory itself.

sys.path.append('/usr/local/django')
sys.path.append('/usr/local/django/mysite') # This part

Reference:

http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

Attachments (1)

15058.diff (1.4 KB) - added by aaugustin 4 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 4 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

I'm going to mark this wontfix --

  • It's a mod_wsgi configuration issue
  • Django's mod_wsgi docs state (correctly) that you need to have the project PYTHONPATH configured
  • The mod_wsgi Django docs describe this specific issue and the solution
  • Django's mod_wsgi docs points at the mod_wsgi Django docs


comment:2 Changed 4 years ago by russellm

  • Component changed from Uncategorized to Documentation
  • Resolution wontfix deleted
  • Status changed from closed to reopened
  • Triage Stage changed from Unreviewed to Accepted

No - wait - on second reading -- our docs could be a little clearer. It isn't (necessarily) as simple as just putting the second entry in your PYTHONPATH, but that will be a common solution.

Changed 4 years ago by aaugustin

comment:3 Changed 4 years ago by aaugustin

Russell, I just attached a proposal, but I'm not sure it is what you had in mind.

It should at least be more beginner-friendly than the current doc.

comment:4 Changed 4 years ago by grahamd

Please be careful about using the reference to 'PYTHONPATH' in documentation related to mod_wsgi setup. People know 'PYTHONPATH' as the environment variable used in command line Python and occasionally have seen people think that because it was mentioned and because they had already set 'PYTHONPATH' in the user environment that everything will work under Apache. This will not be the case because Apache/mod_wsgi runs as different user and will not inherit the users environment. I would personally therefore like to see any mention of 'PYTHONPATH' dropped and simple refer to it as something """Python module search path as defined by 'sys.path'""" or something else similar.

And yes I have been lazy in still not adding a separate page to the mod_wsgi documentation explaining better the whole sys.path, module search path stuff. :-)

comment:5 Changed 4 years ago by aaugustin

#15526 was closed as duplicate.

comment:6 Changed 4 years ago by aaugustin

#12056 is related. It suggests changing the code and not just the docs. It contains comments by core developers.

comment:7 Changed 4 years ago by anonymous

  • Severity set to Normal
  • Type set to Bug

comment:8 Changed 4 years ago by aaugustin

  • Easy pickings unset
  • UI/UX unset

#16564 was closed as duplicate.

comment:9 Changed 4 years ago by aaugustin

#16673 was closed as a duplicate.

comment:10 Changed 3 years ago by timo

  • Resolution set to wontfix
  • Status changed from reopened to closed

I believe this is no longer relevant after r17022

Note: See TracTickets for help on using tickets.
Back to Top