List Info

Thread: py2app and Django




py2app and Django
user name
2006-08-02 20:43:37
Hello,

I'm trying to bundle up a Django built website.  Using
SQLite and  
Django's built-in WSGI webserver, my thinking was that this
would be  
100% Python and would be straight forward to use py2app or
py2exe on it.

I'm not familiar enough with py2app to know whether the
error I'm  
getting is related to py2app or related to Django.  So I
thought I'd  
post what I've done so far here for the list's guidance...

I've followed the guide located here:
http://svn.pythonmac.org/py2app/py2app/trunk/doc/inde
x.html

My directory is basically a straight download of Django-0.95
with the  
addition of 2 files.  "run.py" which is my
wrapper script to add  
Django to the Python path and kickstart the Django
webserver.   
"py2app-setup.py" is named this way because
Django already has a  
setup.py.  This may change once I figure out the details but
for now  
this is what I've done.

=======
run.py:
=======
#!/usr/bin/env python
import sys, os
sys.path.append(os.getcwd())

from Quotes.manage import *
# We can also pass in host:port info to start server on.
# Possibly add checks to see if port is open already and
increment to  
next one
# for the case of >1 app running simultaneously.
execute_manager(settings, ['','runserver'])

# NOTE: execute_manager takes over script control.  If we
want to  
fire up a
# browser window we need to do that in another thread.
# Now that server is running, open web browser?
#import webbrowser
#webbrowser.open_new('http://localhost:8000')

================
py2app-setup.py:
================
#!/usr/bin/env python
from setuptools import setup
setup(
         app=["run.py"],
         setup_requires=["py2app"],
)

Also, "Quotes" is my dummy Django project and is
a subdirectory under  
the Django-0.95 distribution.

I run this command and include a few Django modules:
python py2app-setup.py py2app -- 
includes=django.contrib.auth,django.contrib.sessions,django.
contrib.site 
s

When I run the resulting "run.app" from the
command line, this is the  
error I get:
# ./dist/run.app/Contents/MacOS/run
Validating models...
Unhandled exception in thread started by <function
inner_run at  
0x279ab0>
Traceback (most recent call last):
   File "django/core/management.pyc", line 1039,
in inner_run
   File "django/core/management.pyc", line 1003,
in validate
   File "django/core/management.pyc", line 815,
in get_validation_errors
   File "django/db/__init__.pyc", line 18, in ?
OSError: [Errno 20] Not a directory:
'/Users/rhudson/Desktop/ 
Django-0.95/dist/run.app/Contents/Resources/lib/python2.3/si
te- 
packages.zip/django/db/backends'


As an aside, you may be asking why do I want to make a
website an  
application.  I work for a company that builds health based
education  
websites.  Since some projects are funded by grant money,
the phase  
one project needs to be reviewed to determine if the project
is  
worthy of phase two money.  The reviewers need to remain
anonymous  
and we need to assume the reviewers do not have an internet 

connection.  Therefore, we have to take our product (a
website) and  
bundle it on a CD.  This has led to many problems.  We
currently have  
a working solution for PHP based websites.  Now, we are
investigating  
Django as a new platform and I'm doing the initial testing
on whether  
we can ship a Django website.

Thanks,
Rob
--
Rob Hudson <rhudsonorcasinc.com>
Senior Programmer
Oregon Center for Applied Science
http://www.orcasinc.com



_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
py2app and Django
user name
2006-08-04 00:48:53
On Aug 2, 2006, at 1:43 PM, Rob Hudson wrote:

> I'm trying to bundle up a Django built website.  Using
SQLite and
> Django's built-in WSGI webserver, my thinking was that
this would be
> 100% Python and would be straight forward to use py2app
or py2exe  
> on it.
>
> I'm not familiar enough with py2app to know whether
the error I'm
> getting is related to py2app or related to Django.  So
I thought I'd
> post what I've done so far here for the list's
guidance...
>
> I've followed the guide located here:
> http://svn.pythonmac.org/py2app/py2app/trunk/doc/inde
x.html

Django can not be packaged normally because it has
in-package data  
files. It won't work with either py2exe or py2app without
tweaking.

It may Just Work (or come close to that) with the --packages
option.  
It will definitely not work using any number of --includes
options,  
because that's not the issue.

--packages is not applicable to py2exe though. In that case,
you'll  
need to place the django package next to your .exe and
--exclude it  
so that it doesn't get picked up in the zip.

-bob
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
Numeric on Intel
user name
2006-08-04 07:08:04
Hi,

I have some problems in running Numeric, numpy and numarray
on my Intel 
iMac. This packages compile correclty, but they give me an
import error 
when used.
Where should be the problem ?

Gabriele
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
Numeric on Intel
user name
2006-08-04 07:36:19
 
On Friday, August 04, 2006, at 09:05AM, Gabriele Farina
<g.farinapharaondev.com> wrote:

>Hi,
>
>I have some problems in running Numeric, numpy and
numarray on my Intel 
>iMac. This packages compile correclty, but they give me
an import error 
>when used.
>Where should be the problem ?

What is the traceback you get when you open a python shell
and try to import numeric?

What version of python are you using? Are you using Apple's
python or have you installed some other version (the 2.4.3
universal installer at python.org/pythonmac.org, Python from
Fink, Python from DarwinPorts, ...)?

Ronald

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
Numeric on Intel
user name
2006-08-04 10:43:34
Ronald Oussoren ha scritto:
 >
 > On Friday, August 04, 2006, at 11:55AM, Gabriele
Farina 
<g.farinapharaondev.com> wrote:
 >
 >> Ronald Oussoren ha scritto:
 >>>
 >>> On Friday, August 04, 2006, at 09:05AM,
Gabriele Farina 
<g.farinapharaondev.com> wrote:
 >>>
 >>>> Hi,
 >>>>
 >>>> I have some problems in running Numeric,
numpy and numarray on my 
Intel
 >>>> iMac. This packages compile correclty, but
they give me an import 
error
 >>>> when used.
 >>>> Where should be the problem ?
 >>> What is the traceback you get when you open a
python shell and try 
to import numeric?
 >>>
 >>> What version of python are you using? Are you
using Apple's python 
or have you installed some other version (the 2.4.3
universal installer 
at python.org/pythonmac.org, Python from Fink, Python from
DarwinPorts, 
...)?
 >>>
 >>> Ronald
 >>>
 >>>
 >>
 >> Hi,
 >>
 >> I'm using Python 2.4.1, installed using the
universal DMG found (I
 >> think, I can't remeber it very well) on the
python website.
 >>
 >> The exception raised when typing "import
Numeric" is:
 >>
 >> ----
 >>
 >> Traceback (most recent call last):
 >>   File "<stdin>", line 1, in ?
 >>   File
 >> 
"/Library/Frameworks/Python.framework/Versions/2.4/lib
/python2.4/site-packages/Numeric/Numeric.py", 

 >> line 91, in ?
 >>     import multiarray
 >> ImportError: Inappropriate file type for dynamic
loading
 >> ----
 >
 > This seems to be an architecture mismatch. AFAIK the
2.4.1 installer 
you can find on the mac download page at python.org is not a
universal 
binary installer, but PPC only.  Could you please update to 
http://www.python.org/ftp/python/
2.4.3/Universal-MacPython-2.4.3-2006-04-07.dmg 
to see if that solves your problem? At the very least python
should get 
twice as fast 
 >
 > Ronald
 >
 >

Ok, I'll istall this version and then I tell you if it
works correctly
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
Numeric on Intel
user name
2006-08-04 10:52:20
I updated the python version, recompiled all the packages
and it works 
correctly.

thanks
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
Numeric on Intel
user name
2006-08-04 11:30:24
 
On Friday, August 04, 2006, at 12:49PM, Gabriele Farina
<g.farinapharaondev.com> wrote:

>I updated the python version, recompiled all the
packages and it works 
>correctly.

Great. I've also asked the python.org webmasters to change
the download page, the 2.4.1 installer shouldn't be
mentioned on the mac page.

Ronald

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
Numeric on Intel
user name
2006-08-04 16:41:11
Gabriele Farina wrote:
> I updated the python version, recompiled all the
packages and it works 
> correctly.

FWIW, there are Universal packages for numpy, Numeric and
numarray at:

http://www
.pythonmac.org/packages/py24-fat

We've got to get that page more prominent! No newbies seem
to find it.

Ronald Oussoren wrote:
> I've also asked the python.org webmasters to change
the download page.

That's a start. We also need to make sure the
"Packages" page is easy to 
find when you go to the pythonmac.org main page.

Bob, will you accept a patch to that page? -- it really
needs updating.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer
                                     		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barkernoaa.gov
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
[1-8]

about | contact  Other archives ( Real Estate discussion Medical topics )