Cannot build psycopg2 in x86_64

2009-09-28 Thread Simon Lee

I am trying to deploy the django app that from the django development
server to the Apache on Leopard. When I try to launch the app from my
browser, I got a "Internal Server Error". I checked the error_log and
here's the error:

[Mon Sep 28 00:43:29 2009] [error] [client 127.0.0.1]
ImproperlyConfigured: Error loading psycopg2 module: dlopen(/Users/
simonlee/django/lib/python2.5/site-packages/psycopg2/_psycopg.so, 2):
no suitable image found.  Did find:
[Mon Sep 28 00:43:29 2009] [error] [client 127.0.0.1] \t/Users/
simonlee/django/lib/python2.5/site-packages/psycopg2/_psycopg.so: no
matching architecture in universal wrapper

I did google search and follow the advise on

http://ronny.haryan.to/archives/2008/09/12/psycopg2-and-64-bit-apache-on-leopard/

After the build as advise on that article, I only get _psycopg.so for
2 architectures: i386 and ppc7400, not x86_64. What can I do to build
x86_64 for psycopg2?

I am using the Apache that comes with Apple (I think it is in 64 bit).
I am also using the python2.5 that comes with Leopard. The PostgreSQL
was downloaded from www.postgresql.org under the Binary Packages for
Mac OSX. Any advise is greatly appreciated. Thanks.

Simon
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django admin templates not loading

2009-09-11 Thread Simon Lee

Hi Karen,

Thank you for pointing this out. I followed your advise and it works
beautifully.

As you see, I am a newbie to all these. On another subject, is there a
preferred location to put the production website(s) files/directories
on Linux? Is it right to put them in /var/www/ or should I put them
in /Users/my_name/??? How should I set the permission of the files/
directories under the production sites' directories? Should I set the
user/group to be apache, root, or just under my_name? Please advise.

Simon

On Sep 9, 7:52 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Wed, Sep 9, 2009 at 7:23 AM, Simon Lee <hago...@yahoo.com> wrote:
>
> > Hi All,
>
> > I am following the tutorial in the Django website (writing your first
> > django app) and get it to work on the development server. However,
> > when I port to Apache, the admin template is not loaded and thus I
> > could not get the nice Django UI with Apache. I try copying the
> > default django admin templates into my project root and add the path
> > to the TEMPLATE_DIRS in settings.py but still cannot get the django UI
> > in the login page and the admin dashboard.
>
> > Below is my settings:
>
> > OS: Fedora 11
> > Apache: 2.2 with mod_wsgi
> > Django: 1.1
>
> > [snip]
> >  Settings.py
>
> > [snip]
> > # URL prefix for admin media -- CSS, JavaScript and images. Make sure
> > to use a
> > # trailing slash.
> > # Examples: "http://foo.com/media/;, "/media/".
> > ADMIN_MEDIA_PREFIX = '/media/'
>
> > [snip]
>
> When I typed inhttp://127.0.0.1:8000/myapp/adminin the browser when> the 
> development server runs the code. The output is perfect.
>
> > When the development server is not running and I typed in
> >http://localhost/myapp/admin, it prompt me the login page but without
> > all the styling as before. I can login and go to the admin dashboard
> > page but again the display is not with the django admin template.
>
> Missing styling means missing CSS, and has nothing to do with templates.
> The fact that the pages are getting delivered without template not found
> exceptions means there is not a problem with templates (and you should un-do
> copying the admin templates into your own tree as that is likely just to
> cause confusion down the road.)
>
> You need to set up your Apache server to serve the admin media files (which
> will have urls starting with ADMIN_MEDIA_PREFIX).  These are static files
> and so not served by Django, except when you are running the development
> server there is an admin media server that automagically serves them out of
> the Django source tree.  The files are located under
> django/contrib/admin/media. The doc for setting up static file serving with
> mod_wsgi is here:
>
> http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/#servin...
>
> Karen
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django admin templates not loading

2009-09-09 Thread Simon Lee

Hi All,

I am following the tutorial in the Django website (writing your first
django app) and get it to work on the development server. However,
when I port to Apache, the admin template is not loaded and thus I
could not get the nice Django UI with Apache. I try copying the
default django admin templates into my project root and add the path
to the TEMPLATE_DIRS in settings.py but still cannot get the django UI
in the login page and the admin dashboard.

Below is my settings:

OS: Fedora 11
Apache: 2.2 with mod_wsgi
Django: 1.1

--

Projects/App:

/var/www/mysite/
apache/
 myapp.wsgi
polls/
admin.py
__init__.py
models.py
tests.py
templates/
 admin/
  base_site.html
__init__.py
manage.py
settings.py
urls.py

--

 Settings.py

# Django settings for mysite project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_em...@domain.com'),
)

MANAGERS = ADMINS

DATABASE_ENGINE = 'postgresql_psycopg2'   #
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'mytestdb' # Or path to database file if
using sqlite3.
DATABASE_USER = 'postgres' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost.
Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not
used with sqlite3.

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as
your
# system time zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as
not
# to load the internationalization machinery.
USE_I18N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use
a
# trailing slash if there is a path component (optional in other
cases).
# Examples: "http://media.lawrence.com;, "http://example.com/media/;
MEDIA_URL = ''

# URL prefix for admin media -- CSS, JavaScript and images. Make sure
to use a
# trailing slash.
# Examples: "http://foo.com/media/;, "/media/".
ADMIN_MEDIA_PREFIX = '/media/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'rg+av$-m5%#hs47_^24c54wi!*gauqz4ya1o*^0vjo7=n&'

# List of callables that know how to import templates from various
sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
)

ROOT_URLCONF = 'mysite.urls'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/
django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
'/var/www/mysite/templates',
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'mysite.polls',
'django.contrib.admin'
)

--

myapp.wsgi

import os
import sys

sys.path.append('/var/www')

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

---

urls.py

from django.conf.urls.defaults import *

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
)

---

When I typed in http://127.0.0.1:8000/myapp/admin in the browser when
the development server runs the code. The output is perfect.

When the development server is not running and I typed in
http://localhost/myapp/admin, it prompt me the login page but without
all the styling as before. I can login and go to the admin dashboard
page but again the display is not with the django admin template.

I try leaving the TEMPLATE_DIRS in the settings.py blank but still the
same output.

I changed the user/group for all the files/directories inside my
project to "apache" hoping that this is a permission issue but it does
not help either.

Please tell me what I am missing. Many thanks.

Simon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 

Re: Error in setting up psycopg2

2009-08-25 Thread Simon Lee

Hi Thomas,

I did a Google search and did as one suggestion:
$ export PYTHONPATH=$HOME/:$PYTHONPATH
$ export DJANGO_SETTINGS_MODULE=mysite3.settings
$ python
>>> from django.contrib.sessions.backends import db

It works with no error. The same thing works if I do "python manage.py
shell" without the export.

That does not solve my problem though. I changed myapp.wsgi to the
following:

--

import os, sys
sys.path.append('/Users/simonlee')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite3.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

--

It shows the following error in my log:

[Tue Aug 25 19:12:24 2009] [info] [client 127.0.0.1] mod_wsgi
(pid=170, process='', application='www.test-hago-group.com|'): Loading
WSGI script '/Users/simonlee/mysite3/apache/myapp.wsgi'.
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1] mod_wsgi
(pid=170): Exception occurred processing WSGI script '/Users/simonlee/
mysite3/apache/myapp.wsgi'.
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1] Traceback (most
recent call last):
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/core/handlers/wsgi.py", line 241, in __call__
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1] response =
self.get_response(request)
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/core/handlers/base.py", line 73, in get_response
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1] response =
middleware_method(request)
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/contrib/sessions/middleware.py", line 10, in process_request
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1] engine =
import_module(settings.SESSION_ENGINE)
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/utils/importlib.py", line 35, in import_module
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1] __import__
(name)
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/contrib/sessions/backends/db.py", line 2, in 
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1] from
django.contrib.sessions.models import Session
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/contrib/sessions/models.py", line 4, in 
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1] from
django.db import models
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/db/__init__.py", line 41, in 
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1] backend =
load_backend(settings.DATABASE_ENGINE)
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/db/__init__.py", line 17, in load_backend
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1] return
import_module('.base', 'django.db.backends.%s' % backend_name)
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/utils/importlib.py", line 35, in import_module
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1] __import__
(name)
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/db/backends/postgresql_psycopg2/base.py", line 22, in 
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1] raise
ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]
ImproperlyConfigured: Error loading psycopg2 module: dlopen(/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
psycopg2/_psycopg.so, 2): Symbol not found: _PQbackendPID
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   Referenced
from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
site-packages/psycopg2/_psycopg.so
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   Expected in:
dynamic lookup
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]

---

I did a search on the web but found only two links on similar error
without any solution. Does anyone know what caused "Symbol not found:
_PQbackendPID"?

Simon

On Aug 25, 4:25 pm, Simon Lee <hago...@yahoo.com> w

Re: Error in setting up psycopg2

2009-08-25 Thread Simon Lee
Hi Thomas,
When I typed the following into my python console as advised:
>>> from django.contrib.session.backends import db
I got the following error:
Traceback (most recent call last):  File "", line 1, in   File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/contrib/sessions/backends/db.py",
 line 2, in     from django.contrib.sessions.models import 
Session  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/contrib/sessions/models.py",
 line 4, in     from django.db import models  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/__init__.py",
 line 10, in     if not settings.DATABASE_ENGINE:  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/utils/functional.py",
 line 269, in __getattr__    self._setup()  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/conf/__init__.py",
 line 38, in _setup    raise ImportError("Settings cannot be
 imported, because environment variable %s is undefined." % 
ENVIRONMENT_VARIABLE)ImportError: Settings cannot be imported, because 
environment variable DJANGO_SETTINGS_MODULE is undefined.
I searched "/Users/myname/mysite3/settings.py" for the variable SESSION_ENGINE 
but it is not defined in that file. I don't know where settings.SESSION_ENGINE 
is defined???
Simon

--- On Mon, 8/24/09, Thomas Guettler <h...@tbz-pariv.de> wrote:

From: Thomas Guettler <h...@tbz-pariv.de>
Subject: Re: Error in setting up psycopg2
To: "Simon Lee" <hago...@yahoo.com>, django-users@googlegroups.com
Date: Monday, August 24, 2009, 11:17 PM


Hi Simon,

your first traceback looked like this:

[Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1] mod_wsgi
(pid=120): Exception occurred processing WSGI script '/Users/myname/
mysite3/apache/myapp.wsgi'.
[Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1] Traceback (most
recent call last):
[Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1]   File "/Users/
myname/mysite3/django/core/handlers/wsgi.py", line 239, in __call__
[Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1]   File "/Users/
myname/mysite3/django/core/handlers/base.py", line 67, in get_response
[Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1]   File "/Users/
myname/mysite3/django/contrib/sessions/middleware.py", line 9, in
process_request
[Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1] ImportError: No
module named db

My line 9 of middleware.py of sessions looks like this:
engine = __import__(settings.SESSION_ENGINE, {}, {}, [''])

What does your variable settings.SESSION_ENGINE look like?

Is it 'django.contrib.sessions.backends.db'?

Try to import this as www user:
w...@host> python
>>> from django.contrib.session.backends import db

Does this work?

Simon Lee schrieb:
> You are right. I am a newbie on Linux, trying hard to learn it at the
> same time with the other stuff.
> 
> I did the following in the shell:
> 
> macbook:~myname$ su
> Password: 
> sh-3.2# su - _www
> sh-3.2# more /Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/site-packages/psycopg2/tz.py
> 
> I can read the file with more. Seems that there is no problem on
> permission. Please advise.
> 


-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de





  
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error in setting up psycopg2

2009-08-21 Thread Simon Lee

Thank you for being patient in helping me out.

I checked it /etc/passwd and found this line which I think is the
reference for UID 70

_www:*:70:70:World Wide Web Server:/Library/WebServer:/usr/bin/false

I did "su - _www" (I hope I did this right). It still asked for a
password which I entered my root password (the only password that I
know) and it complained that the password is wrong.

Please advise.

Simon

On Aug 22, 2:30 am, Randy Barlow <rbar...@americanri.com> wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Simon Lee declared:
>
> > Hi Thomas,
>
> > Ok, I put in the "assert False, os.getuid()". The error log logged the
> > following:
>
> > [Fri Aug 21 23:37:48 2009] [error] [client 127.0.0.1]     assert
> > False, os.getuid()
> > [Fri Aug 21 23:37:48 2009] [error] [client 127.0.0.1] AssertionError:
> > 70
>
> > Then, I go the shell and entered "su - 70". It asked for the password.
> > I entered my root password, that's the only password that I set before
> > and the only password I know. But it said the password is wrong. I
> > cannot go any further as your advised. What should I do? I am not too
> > familiar with using Linux. Please help.
>
> The problem is that su wants a username and you are giving it a user id.
>  You can look in /etc/passwd to see what user has UID 70 and then su -
> .
>
> - --
> Randy Barlow
> Software Developer
> The American Research Institutehttp://americanri.com
> 919.228.4971
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> iEYEARECAAYFAkqO58wACgkQw3vjPfF7QfVV7gCfTU3JLho3zVZ7viiHWJefkF6z
> o1wAnjgRLCGgNF4sGSL5d/iSyhMtph9/
> =hkaK
> -END PGP SIGNATURE-
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error in setting up psycopg2

2009-08-21 Thread Simon Lee

Hi Thomas,

Ok, I put in the "assert False, os.getuid()". The error log logged the
following:

[Fri Aug 21 23:37:48 2009] [error] [client 127.0.0.1] assert
False, os.getuid()
[Fri Aug 21 23:37:48 2009] [error] [client 127.0.0.1] AssertionError:
70

Then, I go the shell and entered "su - 70". It asked for the password.
I entered my root password, that's the only password that I set before
and the only password I know. But it said the password is wrong. I
cannot go any further as your advised. What should I do? I am not too
familiar with using Linux. Please help.

Simon

On Aug 21, 2:18 pm, Thomas Guettler <h...@tbz-pariv.de> wrote:
> Hi Simon,
>
> it could be a permission problem:
>
> in the code do something like
>
> assert False, os.getuid().
>
> then on the shell, you need get this user:
> su - corresponding-user
> id # check if you have this UID
> #try to open the file:
> more /.../tz.py
>
> HTH,
>   Thomas
>
> Simon Lee schrieb:
>
> > tz.py is in the directory: "'/Library/Frameworks/Python.framework/
> > Versions/2.6/lib/python2.6/site-packages/psycopg2" which is in the
> > sys.path list. Why does the import still fail? Please advise.
>
> --
> Thomas Guettler,http://www.thomas-guettler.de/
> E-Mail: guettli (*) thomas-guettler + de
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error in setting up psycopg2

2009-08-20 Thread Simon Lee

tz.py is in the directory: "'/Library/Frameworks/Python.framework/
Versions/2.6/lib/python2.6/site-packages/psycopg2" which is in the
sys.path list. Why does the import still fail? Please advise.

Simon

On Aug 20, 4:37 pm, Thomas Guettler <h...@tbz-pariv.de> wrote:
> The important part: cannot import tz.
>
> Maybe you need to install it. I don't this module.
>
>   Thomas
>
> Simon Lee schrieb:
>
>
>
>
>
> > Hi Thomas,
>
> > Tried your method and modified /mysite3/apache/myapp.wsgi as followed:
>
> > import os, sys
> > sys.path.append('/Users/myname')
> > sys.path.append('/Library/Frameworks/Python.framework/Versions/2.6/lib/
> > python2.6/site-packages/django')
> > sys.path.append('/Library/Frameworks/Python.framework/Versions/2.6/lib/
> > python2.6/site-packages/psycopg2')
>
> > try:
> >     import psycopg2 as Database
> > except ImportError, exc:
> >     import sys
> >     raise ImportError('%s %s' % (exc, sys.path))
>
> > os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite3.settings'
> > import django.core.handlers.wsgi
> > application = django.core.handlers.wsgi.WSGIHandler()
>
> > 
>
> > Now the error log is as followed:
>
> > [Wed Aug 19 23:58:54 2009] [info] [client 127.0.0.1] mod_wsgi
> > (pid=135, process='', application='www.test-mysite.com|'): Reloading
> > WSGI script '/Users/myname/mysite3/apache/myapp.wsgi'.
> > [Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1] mod_wsgi
> > (pid=135): Target WSGI script '/Users/myname/mysite3/apache/
> > myapp.wsgi' cannot be loaded as Python module.
> > [Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1] mod_wsgi
> > (pid=135): Exception occurred processing WSGI script '/Users/myname/
> > mysite3/apache/myapp.wsgi'.
> > [Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1] Traceback (most
> > recent call last):
> > [Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1]   File "/Users/
> > myname/mysite3/apache/myapp.wsgi", line 10, in 
> > [Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1]     raise
> > ImportError('%s %s' % (exc, sys.path))
> > [Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1] ImportError:
> > cannot import name tz ['/Library/Frameworks/Python.framework/Versions/
> > 2.6/lib/python26.zip', '/Library/Frameworks/Python.framework/Versions/
> > 2.6/lib/python2.6', '/Library/Frameworks/Python.framework/Versions/2.6/
> > lib/python2.6/plat-darwin', '/Library/Frameworks/Python.framework/
> > Versions/2.6/lib/python2.6/plat-mac', '/Library/Frameworks/
> > Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-
> > scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.6/
> > lib/python2.6/lib-tk', '/Library/Frameworks/Python.framework/Versions/
> > 2.6/lib/python2.6/lib-old', '/Library/Frameworks/Python.framework/
> > Versions/2.6/lib/python2.6/lib-dynload', '/Library/Frameworks/
> > Python.framework/Versions/2.6/lib/python2.6/site-packages', '/Users/
> > myname', '/Library/Frameworks/Python.framework/Versions/2.6/lib/
> > python2.6/site-packages/django', '/Library/Frameworks/Python.framework/
> > Versions/2.6/lib/python2.6/site-packages/psycopg2']
>
> > 
>
> > Any idea? Please advise. Thanks.
>
> > Simon
>
> > On Aug 19, 10:44 pm, Thomas Guettler <h...@tbz-pariv.de> wrote:
> >> Hi,
>
> >> you need to know what sys.path looks like. This is a list of
> >> searched directories.
>
> >> try:
> >>     import  # Import lines that failes
> >> except ImportError, exc:
> >>     import sys
> >>     raise ImportError('%s %s' % (exc, sys.path))
>
> >> Then check if the stuff you want to import is on sys.path.
>
> >> Simon Lee schrieb:
>
> >>> I am trying to set up a simple test website in the Apache Server that
> >>> comes with OSX 10.5.8 and continuously ran into errors that
> >>> complainted about not able to import something in pscycopg2. The site
> >>> works if I ran with the django development server. When I port to
> >>> Apache, it did not work. Can someone tell me what I am missing?
> >>> ...
> >> ...
> >>> The following error was logged in my error log file:
> >>> [Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1] mod_wsgi
> >>> (pid=120): Exception occurred processing WSGI script '/Users/myname/
> >>> mysite3/apache/myapp.wsgi'.
> >>> [Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1] Traceback (most
> >>> recent call last):
> >>&g

Re: Error in setting up psycopg2

2009-08-19 Thread Simon Lee

Hi Thomas,

Tried your method and modified /mysite3/apache/myapp.wsgi as followed:

import os, sys
sys.path.append('/Users/myname')
sys.path.append('/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django')
sys.path.append('/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/psycopg2')

try:
import psycopg2 as Database
except ImportError, exc:
import sys
raise ImportError('%s %s' % (exc, sys.path))

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite3.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()



Now the error log is as followed:

[Wed Aug 19 23:58:54 2009] [info] [client 127.0.0.1] mod_wsgi
(pid=135, process='', application='www.test-mysite.com|'): Reloading
WSGI script '/Users/myname/mysite3/apache/myapp.wsgi'.
[Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1] mod_wsgi
(pid=135): Target WSGI script '/Users/myname/mysite3/apache/
myapp.wsgi' cannot be loaded as Python module.
[Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1] mod_wsgi
(pid=135): Exception occurred processing WSGI script '/Users/myname/
mysite3/apache/myapp.wsgi'.
[Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1] Traceback (most
recent call last):
[Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1]   File "/Users/
myname/mysite3/apache/myapp.wsgi", line 10, in 
[Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1] raise
ImportError('%s %s' % (exc, sys.path))
[Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1] ImportError:
cannot import name tz ['/Library/Frameworks/Python.framework/Versions/
2.6/lib/python26.zip', '/Library/Frameworks/Python.framework/Versions/
2.6/lib/python2.6', '/Library/Frameworks/Python.framework/Versions/2.6/
lib/python2.6/plat-darwin', '/Library/Frameworks/Python.framework/
Versions/2.6/lib/python2.6/plat-mac', '/Library/Frameworks/
Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-
scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.6/
lib/python2.6/lib-tk', '/Library/Frameworks/Python.framework/Versions/
2.6/lib/python2.6/lib-old', '/Library/Frameworks/Python.framework/
Versions/2.6/lib/python2.6/lib-dynload', '/Library/Frameworks/
Python.framework/Versions/2.6/lib/python2.6/site-packages', '/Users/
myname', '/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django', '/Library/Frameworks/Python.framework/
Versions/2.6/lib/python2.6/site-packages/psycopg2']



Any idea? Please advise. Thanks.

Simon

On Aug 19, 10:44 pm, Thomas Guettler <h...@tbz-pariv.de> wrote:
> Hi,
>
> you need to know what sys.path looks like. This is a list of
> searched directories.
>
> try:
>     import  # Import lines that failes
> except ImportError, exc:
>     import sys
>     raise ImportError('%s %s' % (exc, sys.path))
>
> Then check if the stuff you want to import is on sys.path.
>
> Simon Lee schrieb:
>
>
>
>
>
> > I am trying to set up a simple test website in the Apache Server that
> > comes with OSX 10.5.8 and continuously ran into errors that
> > complainted about not able to import something in pscycopg2. The site
> > works if I ran with the django development server. When I port to
> > Apache, it did not work. Can someone tell me what I am missing?
> > ...
> ...
> > The following error was logged in my error log file:
>
> > [Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1] mod_wsgi
> > (pid=120): Exception occurred processing WSGI script '/Users/myname/
> > mysite3/apache/myapp.wsgi'.
> > [Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1] Traceback (most
> > recent call last):
> > [Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1]   File "/Users/
> > myname/mysite3/django/core/handlers/wsgi.py", line 239, in __call__
> > [Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1]   File "/Users/
> > myname/mysite3/django/core/handlers/base.py", line 67, in get_response
> > [Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1]   File "/Users/
> > myname/mysite3/django/contrib/sessions/middleware.py", line 9, in
> > process_request
> > [Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1] ImportError: No
> > module named db
>
> Here you will find your ImportError and sys.path.
>
> --
> Thomas Guettler,http://www.thomas-guettler.de/
> E-Mail: guettli (*) thomas-guettler + de
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Error in setting up psycopg2

2009-08-18 Thread Simon Lee

I am trying to set up a simple test website in the Apache Server that
comes with OSX 10.5.8 and continuously ran into errors that
complainted about not able to import something in pscycopg2. The site
works if I ran with the django development server. When I port to
Apache, it did not work. Can someone tell me what I am missing?



The set up is as followed:
Python
- version: 2.6
- installed location: /Library/Frameworks/Python.framework/Versions/
2.6/

Psycopg2
- version: 2.0.12
- installed location: /Library/Frameworks/Python.framework/Versions/
2.6/lib/python2.6/site-packages/psycopg2

Other installed components:
mod_wsgi-3.0c4



My test site stuff is in "/Users/myname/mysite3"

Inside "/Users/myname/mysite3", the following files and directories
exist:
- __init__.py
- manage.py
- settings.py
- urls.py
- apache (folder)
  - myapp.wsgi
- blog (django app folder)
  - __init__.py
  - models.py (empty)
  - views.py
- django (folder, symbolic link to the django directory)

--

The content of /mysite3/settings.py is as followed:
DATABASE_ENGINE = 'postgresql_psycopg2'
DATABASE_NAME = 'djangodb'
DATABASE_USER = 'postgres'
DATABASE_PASSWORD = 'myname'
DATABASE_HOST = 'localhost'
DATABASE_PORT = '5432'

ROOT_URLCONF = 'mysite3.urls'

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'mysite3.blog',
)

The rest of the settings are the default



The url address www.test-mysite.com is bind to /mysite3/apache/
myapp.wsgi with the following settings:

In "/etc/apache2/http.conf":
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf

In "/private/etc/apache2/extra/httpd-vhosts.conf":

ServerName www.test-mysite.com
ServerAdmin webmas...@test-mysite.com
DocumentRoot "/Users/myname/wsgi/documents"
ServerAlias test-mysite.com
ErrorLog "/private/var/log/apache2/mysite.com-error_log"
CustomLog "/private/var/log/apache2/mysite.com-access_log" common


  Order allow,deny
  Allow from all



Order deny,allow
Allow from all


WSGIScriptAlias / /Users/myname/mysite3/apache/myapp.wsgi





The content of /mysite3/apache/myapp.wsgi is as followed:

import os, sys
sys.path.append('/Users/simonlee')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite3.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

---

When I entered www.test-mysite.com into the browser, it gave me the
following error message:

Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request

The following error was logged in my error log file:

[Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1] mod_wsgi
(pid=120): Exception occurred processing WSGI script '/Users/myname/
mysite3/apache/myapp.wsgi'.
[Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1] Traceback (most
recent call last):
[Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1]   File "/Users/
myname/mysite3/django/core/handlers/wsgi.py", line 239, in __call__
[Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1]   File "/Users/
myname/mysite3/django/core/handlers/base.py", line 67, in get_response
[Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1]   File "/Users/
myname/mysite3/django/contrib/sessions/middleware.py", line 9, in
process_request
[Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1] ImportError: No
module named db

--

I tried everything that I found on the web but nothing seems to work.
Any suggestion would be much appreciated.

Simon

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---