Django

Jasper Frumau jasperfrumau at gmail.com
Sat Jan 23 03:55:02 PST 2010


On Sat, Jan 23, 2010 at 2:24 PM, Scott Haneda <talklists at newgeo.com> wrote:

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

$ head -n1 /opt/local/lib/python2.4/site-packages/django/bin/django-admin.py
#!/usr/bin/env python


>
> 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,


So it is 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.
>

So maybe the maintainer of this port should adjust  #!/usr/bin/env python

$ port info py-django
py-django @1.1.1 (python, www)
Variants:             bash_completion

Description:          Django is a high-level Python Web framework that
encourages rapid development and clean, pragmatic design.
Homepage:             http://www.djangoproject.com

Library Dependencies: python24, py-setuptools
Platforms:            darwin
License:              unknown
Maintainers:          arthurk at macports.org

Should I email Artur K as well?

>
> 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.


Neither do I...


>  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.
>

I agree. Will take some time for me to fully understand all this though.

>
> >>>> 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@ *
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-users/attachments/20100123/a0cb59b8/attachment.html>


More information about the macports-users mailing list