> I just sent a reply, but I guess I don't know how to use Google groups
> so well (sorry). I think it went directly to the author instead of
> posting here.

Yes indeed, it did go directly to me :)

> Basically I don't understand Tim's answer and could it
> be explained a bit more?

I'll see what I can do.  For the others on the list, I also got 
the following via direct email:

> Hi, I am a complete moron. Will you translate this into English? ;)
> 
> What do you mean by $PYTHONPATH and how do you "include" something?

PYTHONPATH is an optional environment variable that instructs 
Python where to look for modules to load.  If it's not set, 
Python uses a select few places that can be shown by issuing

   bash$ python
   [copyright info]
   >>> import sys
   >>> sys.path
   [output of all the places Python looks for modules that can be 
"import"ed]

You can set your PYTHONPATH first:

   bash$ export PYTHONPATH=/path/to/someplace/not/in/sys.path/
   bash$ python
   [copyright info]
   >>> import sys
   >>> sys.path
   [output of all the places Python looks for modules that can be 
"import"ed which should now include "/path/to/..." which I 
believe falls at the beginning of the list]

Django is just a Python module (or group of modules), so the 
"installation" just involves putting the contents someplace in 
the sys.path.  If you run the default install as an admin, 
Django's files get dropped in the system-wide Python module 
repository.  For me here, that's likely 
/usr/lib/python2.4/site-packages/ but may vary depending on your 
setup/OS.

If you're not the administrator (or, like me, you want to install 
various versions of Django and flip between them), you can just 
so something like the following, choosing case #1 or #2 depending 
on what tools you have access to:

   bash$ cd ~/code
1 bash$ # if you have subversion installed:
1 bash$ svn co http://code.djangoproject.com/svn/django/trunk/ django
2 bash$ # if you don't have subversion installed, but have a .tgz
2 bash$ # snapshot of Django
2 bash$ tar xvfz django.tgz
   bash$ export PYTHONPATH=~/code/django
   bash$ python
   [copyright info]
   >>> import django
   [if all went well, no traceback here]

The secondary problem is that PYTHONPATH needs to be set every 
time a new environment is launched.  In the above example, that 
means that if you log out and log back in again, you have to set 
PYTHONPATH again.  For interactive work, you can set PYTHONPATH 
in your .bashrc/.profile startup file so it gets set every time 
you log in.

However, in a mod_python (and likely mod_wsgi, fastcgi, or 
lighttpd setup) you need to use the config-option du-jour to tell 
your hosting where to find Django and where to find your project:

http://www.djangoproject.com/documentation/modpython/

Thus, you might need your apache config to have a line like

   PythonPath ['/home/snoop/code/django', 
'/home/snoop/code/myproj'] + sys.path

so that mod_python can find both Django's source/modules, and 
your own code in your ~/code/myproj directory.

> So I went to run the installation again to keep a keen eye on what was
> happening, but THIS time it's saying "permission denied" (that didn't
> happen before).

I'm guessing that since you're a non-root user, you don't have 
rights to put Django's modules in the site-wide directory.

> Searching the net for an answer, this one is the closest that
> resembles my issue. But I do not understand your answer.

So you need to instruct the setup to install some place that you 
*can* write (I don't know exactly how to do this, but I'm sure 
one of the many other smart folks on the list will leap in here 
with the right option to pass to setup.py) which would be 
something like

   python setup.py --base=/home/snoop/code/django install

or, as above, you can install the development version either from 
Subversion or, if you have SVN on another machine, you can check 
it out there and then push a tar-ball down to the server, 
un-tar/gzipping there.

This still all assumes that your webhost has support for running 
Django (either mod_python, mod_wsgi, or some other supported 
non-CGI variant)


> Thanks.

Hope this helps.  For the list archive purposes, I've included my 
original email that papertrail included.

-tim

> On Feb 27, 9:15 am, Tim Chase <[EMAIL PROTECTED]> wrote:
>>> I am new to django (coming from ruby on rails) and I want to setup a
>>> django application on a free webhost.
>> A free webhost that allows Django?  Even if it's fairly limited,
>> this is interesting.  Can you tell more?
>>
>>> I have ssh access and executed
>>> the install scriped. But I am not allowed to write in the /usr/
>>> folder, is there any way to install django without writing in the /
>>> usr/ folder ?
>>> Here is the Error :
>>> creating /usr/lib/python2.3/site-packages/django
>>> error: could not create '/usr/lib/python2.3/site-packages/django':
>>> Permissiondenied
>> Django doesn't need to be installed...it merely needs to be in
>> your $PYTHONPATH environment.  Thus, you can simply copy the
>> Django files (or do a Django checkout from the SVN repo) into
>> some place in your home directory, and then configure your
>> deployment to include that directory in your $PYTHONPATH.  You
>> omit the details of what your server is (Apache?  lighttpd?) so
>> the particulars of this vary.  However, the basic gist would be
>> to do something like
>>
>>    cd ~
>>    tar xvfz django-0.96.tgz
>>
>> and then include /home/snoop/django-0.96 in your $PYTHONPATH
>>
>> or, if you want the development head and subversion is installed
>> on your host (if so, I'm *really* interested in this free host):
>>
>>    cd ~
>>    svn cohttp://code.djangoproject.com/svn/django/trunk/
>> django-trunk
>>
>> and include /home/snoop/django-trunk in your $PYTHONPATH.
>>
>> -tim



--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to