On 15/08/09 01:43 PM, Thiago511 wrote:
> mark how do I add a file to %PATH% ?

This isn't a Django issue so much as a (very basic) system
administration issue. I suggest you read about the PATH environment
variable and grasp that instead of blindly following someone else's
instructions about how to do something as simple as adding something to
the PATH. This isn't something that started with Vista. It dates back to
the earliest days of DOS so there are plenty of resources on the web
explaining this. Better yet, you should strive for understanding of
environment variables in general. If you fixate on PATH alone and don't
understand what an environment variable is, you'll have difficulties
with PYTHONPATH as well.

Once you understand these concepts, they're universally-applicable, with
minor variations, to DOS/Windows, OS X, Linux, and a host of other
operating systems. When you decide to deploy your completed Django
project on the server of a hosting provider, in all likelihood, that
server won't be running Windows anyway so it helps to develop this
understanding.

One of our Django hosting clients asked why he was getting import errors
for Reportlab on our VPS when he wasn't on his local development
environment. He suspected it was because Reportlab wasn't installed. He
was right. We replied to him:

"We've installed:

python-reportlab - ReportLab library to create PDF documents using Python

python-reportlab-accel - C coded extension accelerator for the ReportLab
Toolkit

For future reference, you don't necessarily have to wait for us to
install Python libraries into the global Python site-packages. You could
install the Python libraries somewhere in your home directory and put
that directory in PYTHONPATH, as you did with Django itself."

He replied:

"Thanks for that. I should have realised I have access to the Python
installation."

In response, we replied:

"You don't have access to the Python installation in /usr/lib/python.
You have access to your home directory into which you can put Python
libraries and add to PYTHONPATH. There is a big difference. The former
is global. The latter can be different even on a per project basis so I
hesitate to say it's local. If you build another Django project for
another client, nothing stops you from having a different PYTHONPATH for
that project. In fact, we do exactly that because we may have different
versions of Django, or other Python libraries on which we depend, for
each project."

If you understood what I wrote above, you may be wondering, "How can you
have a different PYTHONPATH for each application?" The excerpt below
from the shell script that we use to start|stop|restart the fcgi(*) will
illustrate.

PROJDIR="/home/someuser/projects/someproject/"
PYTHONPATH="/home/someuser/django/:/home/someuser/:/home/someuser/lib/"

/usr/bin/python $PROJDIR/manage.py runfcgi umask=000 pidfile=$PIDFILE
socket=$SOCKET method=$METHOD --pythonpath=$PYTHONPATH

(Watch the line wrapping above. Everything from /usr/bin to PYTHONPATH
below it is on one line.)

(*) The above is for deployment via fcgi using the nginx web server.
-- 
Regards,

Clifford Ilkay
Dinamis
1419-3266 Yonge St.
Toronto, ON
Canada  M4N 3P6

<http://dinamis.com>
+1 416-410-3326

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to