Django

Scott Haneda talklists at newgeo.com
Sat Jan 23 03:24:56 PST 2010


On Jan 23, 2010, at 2:19 AM, Jasper Frumau wrote:

> On Sat, Jan 23, 2010 at 12:39 PM, Scott Haneda <talklists at newgeo.com> wrote:
> 
>> On Jan 22, 2010, at 11:09 PM, Jasper Frumau wrote:
>> 
>> Looking over some more notes, it does look as though people are symbolic
>> linking their Django stuff into some place that their PATH looks.  You may
>> want to give this a try, since of the above links, and two more, that is
>> working for them:
>> 
>> sudo ln -s
>> /opt/local/lib/python2.4/site-packages/django/bin/django-admin.py
>> /opt/local/bin/
>> 
> 
> Yes, sounds better than deleting python and installing it where Django looks
> for it... OK, made the soft link:
> $ sudo ln -s
> /opt/local/lib/python2.4/site-packages/django/bin/django-admin.py
> /opt/local/bin/
> Password:

Can you supply the following:
$head -n1 /opt/local/lib/python2.4/site-packages/django/bin/django-admin.py

This will read the first line of the file django-admin.py

If it returns:
#!/usr/bin/env python

That means the interpreter could be looking in the wrong location, the default location set by whoever wrote the code, making the assumption that Django is installed in a standard location like most other OS's.  This is a logical assumption, for example, all perl files on Mac OS X will start with:

#!/usr/bin/perl

When a set of files is installed by MacPorts, one step in that installation is to 'reinplace' [1] the #!/usr/bin/perl with a new path pointing to the MacPorts perl location.

[1] Reinplace is a MacPorts convention that does string find and replacing.

However, in this case, the path is '/usr/bin/env', and there does not appear to be a Portfile for 'env'.  I do not know much about `env` and what it does when it is given an arguemnt.  My guess is that it will look at the $PATH and start looking for the python there.  This seems a pretty cool use of env for defining you interpreter, and I have no idea why #!/usr/bin/env perl and #!/usr/bin/env php is not adopted.

Something to maybe look into and learn more about.

>>>> then add the django bin to your path, which is probably in one of the do
> 
> Edit ~/.Profile and added the path:
> $ grep PATH ~/.Profile
> # MacPorts Installer addition on 2009-10-20_at_13:11:20: adding an
> appropriate PATH variable for use with MacPorts.
> export PATH=/opt/local/bin:/opt/local/sbin:$PATH
> # Finished adapting your PATH environment variable for use with MacPorts.
> export
> PATH=/opt/local/bin:opt/local/sbin:/opt/local/lib/python2.4/site-packages/django/bin:$PATH
> 
> And:
> 
> $ django-admin.py
> Type 'django-admin.py help' for usage.
> 
> Daniel and Scott you are  heroes!!! Thanks a lot! Learned a lot about $PATH,
> soft links and other stuff today.
> Again Thanks! I appreciate it!

Sure, no problem, have fun with Django and python

-- 
Scott * If you contact me off list replace talklists@ with scott@ * 



More information about the macports-users mailing list