Re: Problem installing pysqlite2 (for use with sqlite3)

2007-10-09 Thread benrawk

It worked, thank you!

I installed a new version of python. Apparently my hoster, vpslink,
doesn't include the development header files in the pre-installed
instance of python.

On Oct 7, 11:32 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On 10/8/07, benrawk <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > [EMAIL PROTECTED] pysqlite-2.3.5]# python setup.py build
> > running build
> > running build_py
> > running build_ext
> > building 'pysqlite2._sqlite' extension
> > gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-
> > D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-
> > size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -
> > D_GNU_SOURCE -fPIC -fPIC -DMODULE_NAME="pysqlite2.dbapi2" -I/ -I/usr/
> > include/python2.4 -c src/module.c -o build/temp.linux-i686-2.4/src/
> > module.o
> > In file included from src/module.c:24:
> > src/connection.h:26:20: error: Python.h: No such file or directory
> > src/connection.h:27:22: error: pythread.h: No such file or directory
> > src/connection.h:28:26: error: structmember.h: No such file or
> > directory
>
> You're missing  the Python development header files.  Not sure how to tell
> you exactly what to get, since I don't know what distribution you are
> running.  For what it's worth on Ubuntu these files are packaged in the
> python2.4-dev package.  Maybe that will give a clue for what you need to get
> for whatever distro you are running?
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Problem installing pysqlite2 (for use with sqlite3)

2007-10-07 Thread benrawk

Hello,

I am new to Django. I have successfully installed sqlite3, but cannot
install its companion program pysqlite2.  Below is the what I get from
running 'python setup.py build'. The error I eventually receive is
'error: command 'gcc' failed with exit status 1'. Any ideas what could
be going on? Thank you for your help!

[EMAIL PROTECTED] pysqlite-2.3.5]# python setup.py build
running build
running build_py
running build_ext
building 'pysqlite2._sqlite' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-
D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-
size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -
D_GNU_SOURCE -fPIC -fPIC -DMODULE_NAME="pysqlite2.dbapi2" -I/ -I/usr/
include/python2.4 -c src/module.c -o build/temp.linux-i686-2.4/src/
module.o
In file included from src/module.c:24:
src/connection.h:26:20: error: Python.h: No such file or directory
src/connection.h:27:22: error: pythread.h: No such file or directory
src/connection.h:28:26: error: structmember.h: No such file or
directory
In file included from src/connection.h:30,
 from src/module.c:24:
src/cache.h:34: error: expected specifier-qualifier-list before
'PyObject_HEAD'
src/cache.h:44: error: expected specifier-qualifier-list before
'PyObject_HEAD'
src/cache.h:61: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'pysqlite_NodeType'
src/cache.h:62: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'pysqlite_CacheType'
src/cache.h:64: error: expected declaration specifiers or '...' before
'PyObject'
src/cache.h:64: error: expected declaration specifiers or '...' before
'PyObject'
src/cache.h:67: error: expected declaration specifiers or '...' before
'PyObject'
src/cache.h:67: error: expected declaration specifiers or '...' before
'PyObject'
src/cache.h:69: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
In file included from src/connection.h:31,
 from src/module.c:24:
src/module.h:30: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/module.h:31: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/module.h:32: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/module.h:33: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/module.h:34: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/module.h:35: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/module.h:36: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/module.h:37: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/module.h:38: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/module.h:39: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/module.h:41: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/module.h:44: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/module.h:45: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/module.h:51: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
In file included from src/module.c:24:
src/connection.h:37: error: expected specifier-qualifier-list before
'PyObject_HEAD'
src/connection.h:111: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'pysqlite_ConnectionType'
src/connection.h:113: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/connection.h:115: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/connection.h:116: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/connection.h:117: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/connection.h:118: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/connection.h:119: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/connection.h:120: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '*' token
src/connection.h:121: error: expected declaration specifiers or '...'
before 'PyObject'
src/connection.h:121: error: expected declaration specifiers or '...'
before 'PyObject'
In file included from src/module.c:25:
src/statement.h:36: error: expected specifier-qualifier-list before
'PyObject_HEAD'
src/statement.h:44: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'pysqlite_StatementType'
src/statement.h:46: error: expected declaration specifiers or '...'
before 'PyObject'
src/statement.h:49: error: expected declaration specifiers or '...'
before 'PyObject'
src/statement.h:50: error: expected declaration specifiers or '...'
before 'PyObject'
src/statement.h:52: error: expected declaration specifiers or '...'
before 'PyObject'
In file included from src/module.c:26:
src/cursor.h:34: error: expected 

urls.py regex problem

2007-03-30 Thread benrawk

Hello,

When I am running the simple current_datetime example from the django
book, and then edit my urls.py to look like the one in the book, the
page doesn't server.

Book urls.py:
  from django.conf.urls.defaults import *
f from mysite.views import current_datetime

  urlpatterns = patterns('',
  (r'^now/$', current_datetime),
  )

Error:
Using the URLconf defined in mysite.urls, Django tried these URL
patterns, in this order:
   1. ^now/$
The current URL, /mysite/now/, didn't match any of these.

When I remove the '^' from the front of the regex pattern and add a
'/', suddenly the page works! Why could the '^' be killing the regex
match?

Thanks,
Ben


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Trouble setting up Django and Apache

2007-03-25 Thread benrawk

Hello all,

With Graham's hint about possible problems caused by SELinux, I
finally figured out what was going on. Django can now serve pages!
Here is what I learned:

SELinux is installed and running by default on Fedora Core 6. This
means that along with the correct file permissions, for files to be
readable by apache they have to have the correct security context.
When you first set up Apache and serve a simple html page from '/var/
www' there is no problem because SELinux has by default already given
this path the correct security context. When you start creating
projects in Django using the 'django-admin.py startproject [project
name]' files are created that do not have the correct security
context.

Default security contexts are controlled by files in '/etc/selinux/
targeted/contexts/files'. If you grep for 'www' in this directory you
will see that '/var/www(/.*)?' has been given the correct security
context, as previously described. Interestingly, directories labeled
'www' under you home directory will also be given the correct security
context by defaule because of the following regx '/home/[^/]*/((www)|
(web)|(public_html))(/.+)? '.

Looking at the security conext of files under the /var/www directory
(using 'ls -Z'), I found that files should have the following context
inorder to be served up by Apache:
'system_u:object_r:httpd_sys_content_t'. This is compared to what my
Django files currently had: 'user_u:object_r:user_home_t'. I had to
change the type of the files, and I did so using the following
command:

chcon -R -t httpd_used_content_t myproject

My knowledge of SELinux configuration is still pretty low, and I will
continue to study it if I run into more problems. The references I
used to figure this all out are here:

http://linux.web.cern.ch/linux/scientific4/docs/rhel-selg-en-4/rhlcommon-chapter-0017.html#RHLCOMMON-SECTION-0066
http://docs.fedoraproject.org/selinux-apache-fc3/sn-simple-setup.html

On Mar 23, 2:30 am, "Graham Dumpleton" <[EMAIL PROTECTED]>
wrote:
> On Mar 23, 6:47 pm, "benrawk" <[EMAIL PROTECTED]> wrote:
>
> > Thank you again for helping. FYI, I am using Fedora Core 6. I set
> > 'PythonHandlermod_python.testhandler' in httpd.conf and got a bunch
> > of info. The sys.path appears to be correct...relevant bits, and then
> > full text beneath.
>
> > sys.path containes /home/benrawk
>
> What is the full path to the directory that Django admin project
> created. Is it:
>
>   /home/benrawk/mysite
>
> What is the output of running:
>
>   ls -las
>
> inside of that directory. Are all the files in that directory readable
> to others.
>
> > REQUEST_URI /mysite/
> > SCRIPT_NAME /mysite
> > PATH_INFO   /
> > PATH_TRANSLATED /var/www/html/index.html
> > ***Is this Path being translated correctly?***
>
> That is normal in this case. Because the request was against the
> directory Apache tried applying targets listed in DirectoryIndex
> directive and first one listed was probably 'index.html'.
>
> > DOCUMENT_ROOT   /var/www/html
> > SCRIPT_FILENAME /var/www/html/mysite
> > ***There is no "mysite" script under the Document root, is this being
> > interpreted correctly?***
>
> Nothing to worry about, just part of Apache's strange URL matching
> algorithm which is made somewhat more confusing by presence of
> mod_python.
>
> Graham


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Trouble setting up Django and Apache

2007-03-23 Thread benrawk

Thank you again for helping. FYI, I am using Fedora Core 6. I set
'PythonHandler mod_python.testhandler' in httpd.conf and got a bunch
of info. The sys.path appears to be correct...relevant bits, and then
full text beneath.

sys.path containes /home/benrawk

REQUEST_URI /mysite/
SCRIPT_NAME /mysite
PATH_INFO   /
PATH_TRANSLATED /var/www/html/index.html
***Is this Path being translated correctly?***

DOCUMENT_ROOT   /var/www/html
SCRIPT_FILENAME /var/www/html/mysite
***There is no "mysite" script under the Document root, is this being
interpreted correctly?***

***FULL TEXT*
Apache version  Apache/2.2.3 (Fedora)
Apache threaded MPM No (single thread MPM)
Apache forked MPM   Yes, maximum 256 processes
Apache server root  /etc/httpd
Apache document root/var/www/html
Apache error log/etc/httpd/logs/error_log (view last 100 lines)
Python sys.version  2.4.4 (#1, Oct 23 2006, 13:58:00) [GCC 4.1.1
20061011 (Red Hat 4.1.1-30)]
Python sys.path:
/home/benrawk
/usr/lib/python2.4/site-packages/setuptools-0.6c1-py2.4.egg
/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg
/usr/lib/python24.zip
/usr/lib/python2.4
/usr/lib/python2.4/plat-linux2
/usr/lib/python2.4/lib-tk
/usr/lib/python2.4/lib-dynload
/usr/lib/python2.4/site-packages
/usr/lib/python2.4/site-packages/Numeric
/usr/lib/python2.4/site-packages/gtk-2.0

Python interpreter name www.benrawk.com
mod_python.publisher available  Yes
mod_python.psp availableYes

DJANGO_SETTINGS_MODULE  mysite.settings
GATEWAY_INTERFACE   CGI/1.1
SERVER_PROTOCOL HTTP/1.1
REQUEST_METHOD  GET
QUERY_STRING
REQUEST_URI /mysite/
SCRIPT_NAME /mysite
PATH_INFO   /
PATH_TRANSLATED /var/www/html/index.html
HTTP_HOST   localhost
HTTP_USER_AGENT Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.9)
Gecko/20061219 Fedora/1.5.0.9-1.fc6 Firefox/1.5.0.9 pango-text
HTTP_ACCEPT text/xml,application/xml,application/xhtml+xml,text/
html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
HTTP_ACCEPT_LANGUAGEen-us,en;q=0.5
HTTP_ACCEPT_ENCODINGgzip,deflate
HTTP_ACCEPT_CHARSET ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP_KEEP_ALIVE 300
HTTP_CONNECTION keep-alive
HTTP_CACHE_CONTROL  max-age=0
PATH/sbin:/usr/sbin:/bin:/usr/bin
SERVER_SIGNATURE
Apache/2.2.3 (Fedora) Server at localhost Port 80
SERVER_SOFTWARE Apache/2.2.3 (Fedora)
SERVER_NAME localhost
SERVER_ADDR ::1
SERVER_PORT 80
REMOTE_ADDR ::1
DOCUMENT_ROOT   /var/www/html
SCRIPT_FILENAME /var/www/html/mysite
REMOTE_PORT 39639

On Mar 22, 10:42 pm, "Graham Dumpleton" <[EMAIL PROTECTED]>
wrote:
> On Mar 23, 2:49 pm, "benrawk" <[EMAIL PROTECTED]> wrote:
>
> > Also, when I import and print sys.path into a python session, with
> > apache running in the background, sys.path does not include '/home/
> > benrawk'. Is it supposed to? Is there a way I can check the value of
> > PythonPath as it is defined in httpd.conf?
>
> Presuming you are using a recent version of mod_python, change your
> PythonHandler directive to:
>
>   PythonHandler mod_python.testhandler
>
> The result of accessing stuff under /mysite will then be a big page of
> information about the request and the environment of Python
> interpreter being used. One of the things will be sys.path and you can
> then verify it is what you expect.
>
> BTW, what OS are you using. Are you perhaps using one of the SELinux
> enabled variants? These systems can put extra access controls on top
> of normal stuff when using Apache such that it may not be enough for
> files to be readable by Apache. I don't understand the full
> implications of using SELinux or how to set it up but it may be an
> issue if you are using it so be clear in stating what environment you
> are using.
>
> Graham


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Trouble setting up Django and Apache

2007-03-22 Thread benrawk

Also, when I import and print sys.path into a python session, with
apache running in the background, sys.path does not include '/home/
benrawk'. Is it supposed to? Is there a way I can check the value of
PythonPath as it is defined in httpd.conf?

On Mar 22, 8:37 pm, "benrawk" <[EMAIL PROTECTED]> wrote:
> Hello, thank your for your reply. Tried everything, getting positive
> results, but still can't loadhttp://localhost/mysite/.
>
> 1) permissions on both /home, /home/benrawk, and /home/benrawk/mysite
> are 'drwxr-xr-x'
>
> 2) I succesfully imported mysite.settings after adding /home/benrawk
> to the sys.path.
>
> 3) mysite/ has __init__.py in it.
>
> Any other ideas? Would really like to get this to work...any help is
> greatly appreciated.
>
> On Mar 22, 1:02 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>
> > On Thu, 2007-03-22 at 07:57 +,benrawkwrote:
> > > Hello,
>
> > > Recieving a common error, but have trolled the message boards, and
> > > have not found a solution. My httpd.conf file contains the following
> > > relevant snippet:
>
> > > 
> > > SetHandler python-program
> > > PythonPath "['/home/benrawk'] + sys.path"
> > > SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > > PythonHandler django.core.handlers.modpython
> > > PythonDebug On
> > > Allow from localhost
> > > 
>
> > > The path of my project file with settings.py in it is /home/benrawk/
> > > mysite.
>
> > Is /home/benrawkreadable by the user running Apache (typically,
> > "apache")? Similarly is mysite/ readable by that user?
>
> > Does your settings.py file have syntax errors in it? If you start a
> > python prompt, import sys and add /home/benrawkto the front of
> > sys.path, can you import mysite.settings without error?
>
> > Does mysite/ have an __init__.py file in it? Actually, this is a
> > redundant question if you passed the previous test, but it might explain
> > why the import failed if you can't even import it from the command line.
>
> > Those are the likely causes of problems: apache can't read the files in
> > question, or settings.py has syntax errors.
>
> > Regards,
> > Malcolm


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Trouble setting up Django and Apache

2007-03-22 Thread benrawk

Hello, thank your for your reply. Tried everything, getting positive
results, but still can't load http://localhost/mysite/.

1) permissions on both /home, /home/benrawk, and /home/benrawk/mysite
are 'drwxr-xr-x'

2) I succesfully imported mysite.settings after adding /home/benrawk
to the sys.path.

3) mysite/ has __init__.py in it.

Any other ideas? Would really like to get this to work...any help is
greatly appreciated.

On Mar 22, 1:02 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2007-03-22 at 07:57 +,benrawkwrote:
> > Hello,
>
> > Recieving a common error, but have trolled the message boards, and
> > have not found a solution. My httpd.conf file contains the following
> > relevant snippet:
>
> > 
> > SetHandler python-program
> > PythonPath "['/home/benrawk'] + sys.path"
> > SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > PythonHandler django.core.handlers.modpython
> > PythonDebug On
> > Allow from localhost
> > 
>
> > The path of my project file with settings.py in it is /home/benrawk/
> > mysite.
>
> Is /home/benrawkreadable by the user running Apache (typically,
> "apache")? Similarly is mysite/ readable by that user?
>
> Does your settings.py file have syntax errors in it? If you start a
> python prompt, import sys and add /home/benrawkto the front of
> sys.path, can you import mysite.settings without error?
>
> Does mysite/ have an __init__.py file in it? Actually, this is a
> redundant question if you passed the previous test, but it might explain
> why the import failed if you can't even import it from the command line.
>
> Those are the likely causes of problems: apache can't read the files in
> question, or settings.py has syntax errors.
>
> Regards,
> Malcolm


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Trouble setting up Django and Apache

2007-03-22 Thread benrawk

Hello,

Recieving a common error, but have trolled the message boards, and
have not found a solution. My httpd.conf file contains the following
relevant snippet:


SetHandler python-program
PythonPath "['/home/benrawk'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonHandler django.core.handlers.modpython
PythonDebug On
Allow from localhost


The path of my project file with settings.py in it is /home/benrawk/
mysite.

The error I am recieving when accesing http://localhost/mysite/
follows, any ideas about what is going on would be greatly
appreciated!

Mod_python error: "PythonHandler django.core.handlers.modpython"

Traceback (most recent call last):

  File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
result = object(req)

  File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/
django/core/handlers/modpython.py", line 163, in handler
return ModPythonHandler()(req)

  File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/
django/core/handlers/modpython.py", line 125, in __call__
if settings.ENABLE_PSYCO:

  File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/
django/conf/__init__.py", line 27, in __getattr__
self._import_settings()

  File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/
django/conf/__init__.py", line 54, in _import_settings
self._target = Settings(settings_module)

  File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/
django/conf/__init__.py", line 82, in __init__
raise EnvironmentError, "Could not import settings '%s' (Is it on
sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
e)

EnvironmentError: Could not import settings 'mysite.settings' (Is it
on sys.path? Does it have syntax errors?): No module named
mysite.settings


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---