simply put the django directory somewhere that is writable, and set your
pythonpath accordingly.
You could create a ~/python directory to hold django and any other
module you might need.
just prepend th ~/python directory to your python path so it looks there
first.
Jeff Anderson
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com
> To unsubscribe from this group, send email to django-users...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>
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':
> Permission denied
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 co http://code.djangoproject.com/svn/django/trunk/
django-trunk
and include /home/snoop/django-trunk in your $PYTHONPATH.
-tim
--- Amit
* Snoop1990 <snoo...@gmx.net> [2008-02-27 08:07 -0800]:
Guessing the problem (which is darn hard without the relevant
information copied in the email...), here are some options:
- Create a .bash_profile yourself
- Or otherwise, try a .bashrc (is your shell bash anyway?)
- Set the PYTHONPATH in front of your script, eg "PYTHONPATH=<path>
python manage.py runserver" or similar
- Hardcode the PYTHONPATH in your script, using sys.path.append(<path>)
Also, have a look at this possibly related thread: http://groups.google.com/group/django-users/browse_thread/thread/d77412f3bbbd1d1a/96eaf99878545253?hl=en&lnk=gst&q=cron#96eaf99878545253
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