Re: Error when posting a comment

2009-03-25 Thread Tonu Mikk

Daniel Roseman wrote:
> On Mar 24, 8:58 pm, Tonu Mikk <tm...@umn.edu> wrote:
>   
>> I posted this on djangothreadedcomments list some days ago, but did not
>> get a response.  Perhaps django users can help me out?
>>
>> Hello, I am attempting to get threaded comments to work on a shared
>> bookmarking application.  It seems that I am almost there, but when I
>> post the comment, I get the following error: "This XML file does not
>> appear to have any style information associated with it. The document
>> tree is shown below."
>>
>> I copied the relevant parts of the application to dpaste.com including
>> models, views and template:  http://dpaste.com/16206/.  Perhaps
>> someone may be able to spot a problem in my application.
>>
>> Thank you!
>>
>> Tonu
>> 
>
> I don't know anything about djangothreadedcomments, but the reason
> you're getting XML is clear from the code you've posted. Your form is
> submitting to whatever the {% get_free_comment_url_xml shared_bookmark
> %} tag resolves to - and going by the name, this is presumably a view
> that returns XML.
>
> Why do you want to return XML? Is there supposed to be an AJAX handler
> in here somewhere? If you don't want XML, use a view that doesn't
> return XML.
Thanks Daniel, eliminating the  "_xml" part from {% 
get_free_comment_url_xml shared_bookmark %} tag fixed the issue.  I 
wonder if the reason the why django threaded comments creators had the 
xml piece in their template was for troubleshooting purposes.  It works 
as expected without it.

Thanks,
Tonu

--~--~-~--~~~---~--~~
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 when posting a comment

2009-03-24 Thread Tonu Mikk

I posted this on djangothreadedcomments list some days ago, but did not 
get a response.  Perhaps django users can help me out?


Hello, I am attempting to get threaded comments to work on a shared
bookmarking application.  It seems that I am almost there, but when I
post the comment, I get the following error: "This XML file does not
appear to have any style information associated with it. The document
tree is shown below."

I copied the relevant parts of the application to dpaste.com including
models, views and template:  http://dpaste.com/16206/ .  Perhaps
someone may be able to spot a problem in my application.

Thank you!

Tonu




--~--~-~--~~~---~--~~
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: linking to files from database

2009-02-25 Thread Tonu Mikk

Alex Gaynor wrote:
>
>
> On Tue, Feb 24, 2009 at 10:41 AM, Daniel Roseman 
> <roseman.dan...@googlemail.com <mailto:roseman.dan...@googlemail.com>> 
> wrote:
>
>
> On Feb 24, 2:36 pm, Tonu Mikk <tm...@umn.edu
> <mailto:tm...@umn.edu>> wrote:
>
> > Then I save it with the above method.  The problem I am running
> into, is that when saving the file, it gives is a different name
> which is the original name with an
> > "_" at the end.  The link in the database also points to the
> file with this new name.  How can I simply create a link in the
> database to the original file?
>
>
> Use a FilePathField rather than a FileField. This just takes a path,
> rather than a file object. See:
> http://docs.djangoproject.com/en/dev/ref/models/fields/#filepathfield
> --
> DR.
>
>
> If you want to reference an existing file what you want to do is just
> obj.file_field = "file/location.txt"
>
> That just assigns the location(the field will act like a file when you 
> try to actually access it).
>
I see, this allows me to upload files using the web interface and still 
create links to existing files in the database.

Thank you,
Tonu


--~--~-~--~~~---~--~~
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: linking to files from database

2009-02-24 Thread Tonu Mikk

Tonu Mikk wrote:
> Jacob Kaplan-Moss wrote:
>   
>> On Tue, Feb 17, 2009 at 1:15 PM, Tonu Mikk <tm...@umn.edu> wrote:
>>   
>> 
>>> Looking at the database, I see a photo and thumbnail columns, but there
>>> is no data.  Do I need to write code to store a link to images in the
>>> photo and thumbnail columns?
>>> 
>>>   
>> Yes, that's it. Read the section of the file reference titled
>> "Additional methods on files attached to objects"
>> (http://docs.djangoproject.com/en/dev/ref/files/file/#additional-methods-on-files-attached-to-objects).
>>
>> You'll want code that looks something like
>> `my_bookmark.photo.save('file_name'.jpg, file_contents)`. 
>> 
In my case I have the files already on the web server.  The only thing 
that I need to do is to link to them from the database.  When I try 
using the method above, I first read the file into memory like so 
(http://docs.djangoproject.com/en/dev/topics/files/#topics-files):

>>> from django.core.files import File

# Create a Python file object using open()
>>> f = open('/tmp/hello.world', 'w')
>>> myfile = File(f)

Then I save it with the above method.  The problem I am running into, is that 
when saving the file, it gives is a different name which is the original name 
with an
"_" at the end.  The link in the database also points to the file with this new 
name.  How can I simply create a link in the database to the original file?

Thank you,
Tonu
 



--~--~-~--~~~---~--~~
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: uploading files

2009-02-17 Thread Tonu Mikk

Karen Tracey wrote:
> On Tue, Feb 17, 2009 at 11:50 AM, Tonu Mikk <tm...@umn.edu 
> <mailto:tm...@umn.edu>> wrote:
>
> Alex Gaynor wrote:
>
> > Uploaded files have a name attribute that contains their name.
> Yes, but how does one take advantage of that in this code?
>
>
> You simply use the name attribute of the UploadedFile instance you are 
> working with.  For example, if you wanted to rewrite the example you 
> cited earlier to use the original name of the uploaded file, it would be:
>
> def handle_uploaded_file(f):
>destination = open(f.name <http://f.name>, 'wb+')
>for chunk in f.chunks():
>destination.write(chunk)
>destination.close()
Karen, thanks for this.  I don't quite see though how I can add the path 
info into this construct.  But here again, lack of Python experience is 
showing.

Tonu

--~--~-~--~~~---~--~~
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: linking to files from database

2009-02-17 Thread Tonu Mikk

Jacob Kaplan-Moss wrote:
> On Tue, Feb 17, 2009 at 1:15 PM, Tonu Mikk <tm...@umn.edu> wrote:
>   
>> Looking at the database, I see a photo and thumbnail columns, but there
>> is no data.  Do I need to write code to store a link to images in the
>> photo and thumbnail columns?
>> 
>
> Yes, that's it. Read the section of the file reference titled
> "Additional methods on files attached to objects"
> (http://docs.djangoproject.com/en/dev/ref/files/file/#additional-methods-on-files-attached-to-objects).
>
> You'll want code that looks something like
> `my_bookmark.photo.save('file_name'.jpg, file_contents)`.
>   
Jacob, thank you.  If I understand this correctly, I can save the files 
that are attached to objects using the above method instead of this from 
page
http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#topics-http-file-uploads
 
:

def handle_uploaded_file(f):
destination = open('some/file/name.txt', 'wb+')
for chunk in f.chunks():
destination.write(chunk)
destination.close()


Tonu 



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



linking to files from database

2009-02-17 Thread Tonu Mikk

Hi,  I have a model like this:
class Bookmark(models.Model):
  title = models.CharField(max_length=200)
  user = models.ForeignKey(User)
  link = models.ForeignKey(Link)
  desc = models.CharField(max_length=500)
  photo = models.ImageField(upload_to="photos/")
  thumbnail = models.ImageField(upload_to="thumbnails/")
  def __str__(self):
return '%s, %s' % (self.user.username, self.link.url)

I am able to upload a file through a form and save it to a directory 
using this code in views.py (I am not using ModelForms):
def handle_uploaded_file(f):
destination = 
open('/home/dmc/projects/django_bookmarks/site_media/photos/file.jpg', 
'wb+')
for chunk in f.chunks():
destination.write(chunk)
destination.close()

When I try to access the image file using following in a template:


I get an error saying "The 'photo' attribute has no file associated with 
it."
Looking at the database, I see a photo and thumbnail columns, but there 
is no data.  Do I need to write code to store a link to images in the 
photo and thumbnail columns? 

Thank you,

--~--~-~--~~~---~--~~
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: uploading files

2009-02-17 Thread Tonu Mikk

Alex Gaynor wrote:
>
>
> On Tue, Feb 17, 2009 at 11:18 AM, Tonu Mikk <tm...@umn.edu 
> <mailto:tm...@umn.edu>> wrote:
>
>
> Hi Django community,
>
> I have a question regarding uploading files.  In this page in Django
> documentation
> 
> http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#topics-http-file-uploads,
> there is an example of handling an uploaded file like so:
>
> def handle_uploaded_file(f):
>destination = open('some/file/name.txt', 'wb+')
>for chunk in f.chunks():
>destination.write(chunk)
>destination.close()
>
> This code saves the uploaded file with the name 'name.txt'.  I
> would like to save the uploaded file with the original file name.
>  How could that be accomplished?
>
> Thank you!
> Tonu
>
>
>
>
> Uploaded files have a name attribute that contains their name.
Yes, but how does one take advantage of that in this code?

Thanks,
Tonu

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



uploading files

2009-02-17 Thread Tonu Mikk

Hi Django community,

I have a question regarding uploading files.  In this page in Django 
documentation 
http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#topics-http-file-uploads,
 
there is an example of handling an uploaded file like so:

def handle_uploaded_file(f):
destination = open('some/file/name.txt', 'wb+')
for chunk in f.chunks():
destination.write(chunk)
destination.close()

This code saves the uploaded file with the name 'name.txt'.  I would like to 
save the uploaded file with the original file name.  How could that be 
accomplished?

Thank you!
Tonu


--~--~-~--~~~---~--~~
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: bookmarks app with images

2009-02-17 Thread Tonu Mikk

Thanks Louis,

It has taken me a while to get my head wrapped around this.  Your 
suggestions helped and I am now moving along. 

Tonu

Louis Sayers wrote:
> Firstly, make sure that you have the enctype="multipart/form-data"
> attribute on your form in your template.
>
> You can create an object of your form by writing:
> formObject = BookmarkSaveForm(request.POST, request.FILES)
>
> test if it's valid:
> if formObject.is_valid():
>
>
> Looking at your Photo model, you are probably wanting a modelForm
> instead of creating a new form.  If you haven't already seen the
> documentation at djangoproject.com under the documentation tab, now
> might be a good place to look.  For modelForms, there's a good bit of
> doc at 
> http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#topics-forms-modelforms
>
> I hope this helps at least a little.
>
>
> On Feb 13, 9:23 am, Tonu Mikk <tm...@umn.edu> wrote:
>   
>> Hello, I am having trouble writing a view to upload images. I am
>> creating a bookmarks application with Django 1.02 that would have a
>> screenshot for each bookmark.  I extended the model in this way to
>> include the images:
>>
>> class Photo(models.Model):
>> title = models.CharField(max_length=50)
>> photo = models.ImageField(upload_to="photos/")
>> bookmarks = models.OneToOneField(Bookmark, primary_key=True)
>>
>> The forms.py file has the following code related to images:
>> class BookmarkSaveForm(forms.Form):
>>   photo = forms.ImageField(
>> label='Upload screenshot',
>> required=False
>> )
>>
>> I am not quite sure how to write views.py code for the saving the images
>> to the specified directories.  Any suggestions on how to get started
>> with this is appreciated.
>>
>> Thank you,
>> Tonu
>> 
> >
>   


-- 
Tonu Mikk
Educational Technology Consultant
Digital Media Center - dmc.umn.edu
tm...@umn.edu 612 625-9221


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



bookmarks app with images

2009-02-12 Thread Tonu Mikk

Hello, I am having trouble writing a view to upload images. I am 
creating a bookmarks application with Django 1.02 that would have a 
screenshot for each bookmark.  I extended the model in this way to 
include the images:

class Photo(models.Model):
title = models.CharField(max_length=50)
photo = models.ImageField(upload_to="photos/")
bookmarks = models.OneToOneField(Bookmark, primary_key=True)

The forms.py file has the following code related to images:
class BookmarkSaveForm(forms.Form):
  photo = forms.ImageField(
label='Upload screenshot',
required=False
)

I am not quite sure how to write views.py code for the saving the images 
to the specified directories.  Any suggestions on how to get started 
with this is appreciated.

Thank you,
Tonu

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



JODConverter with Django

2009-02-10 Thread Tonu Mikk

I am curious if anyone is using JODConverter 
http://www.artofsolving.com/opensource/jodconverter in their Django 
project?  I would be interested in learning from your experience.

Thanks,
Tonu

--~--~-~--~~~---~--~~
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: running shell commands from a file

2009-01-23 Thread Tonu Mikk

I was able to fix this by modifying the settings.py file INSTALLED_APPS 
section by removing django_bookmarks from 'django_bookmarks.bookmarks'.

Tonu

Tonu wrote:
> I am trying to write a small program that imports delicious bookmarks
> into the Django project's database.  When I try the commands using
> manage.py shell , then they work, but when I put the commands into a
> file "feed.py" and try them I receive an error: " ImportError: No
> module named django_bookmarks.bookmarks".  The error occurs on line
> #11 (user = User.objects.get(id=1)).
>
> I tried to make sure in my file that I include the necessary path
> information to the settings file.  I wonder if anyone has insight into
> what I am doing wrong.  Here is the file that I am using.  It resides
> in the django_bookmarks folder.
>
> Thank you,
> Tonu
>
> #!/usr/local/bin/python
> import feedparser
> import os.path
> os.environ['DJANGO_SETTINGS_MODULE']='settings'
> from django.contrib.auth.models import User
> from bookmarks.models import *
> d = feedparser.parse('http://feeds.delicious.com/v2/rss/utools')
>
> link9 = Link(url=d.entries[2].link)
> link9.save()
> user = User.objects.get(id=1)
> link = Link.objects.get(id=9)
> bookmark = Bookmark (
>   title = d.entries[2].title,
>   desc = d.entries[2].description,
>   link = link,
> )
> bookmark.save()
>   


-- 
Tonu Mikk
Educational Technology Consultant
Digital Media Center - dmc.umn.edu
tm...@umn.edu 612 625-9221


--~--~-~--~~~---~--~~
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: porting OpenBookPlatform to Django v1

2008-10-08 Thread Tonu Mikk

Karen, thank you for your thorough response.  It gives me a direction 
and food for thought.

Tonu

Karen Tracey wrote:
> On Wed, Oct 8, 2008 at 2:50 PM, Tonu Mikk <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> Here is a bit more info on the error that I am getting with
> OpenBookPlatform.
>
> When I try to access booklist in OpenBookPlatform I received this
> error:
> Exception Value: Could not import apps.books.views. Error was: cannot
> import name validators
>
> Same error appears when I try to use the Register link:
> Exception Value: Could not import apps.users.views.auth. Error was:
> cannot import name validators
>
> I suspect that I am receiving this error because OpenBookPlatform was
> created in Django version 0.97 and it seems that the django validators
> have changes sufficiently between 1.0 and previous versions.
> I see a line in views.py:  from django.core import validators .  I am
> wondering if I need to be using a different string here?
>
> Thank you,
> Tonu
>
> Tonu Mikk wrote:
> > Hello, I wonder if anyone has tried porting the OpenBookPlatform
> > http://djangosites.org/s/limodou-51boo-com/ to Django v1?  I am
> trying
> > this, but running into problems.  I contacted the project owner,
> but he
> > is not maintaining the code any more.
> >
>
>
> Taking a look at the change history for this project:
>
> http://code.google.com/p/openbookplatform/source/list
>
> shows that the last code change was made over a year ago.  There were 
> a lot of backwards-incompatible changes made in Django over the last 
> year (fully documented on the backwards-incompatible page and the 1.0 
> porting guide).  It is not going to be as simple as fixing this one 
> import that is no longer working.  Since the original owner is no 
> longer maintaining the code, you've got to decide whether you want to 
> port the existing code to 1.0 yourself or start afresh (I have never 
> heard of this project before so have no idea what it does or how big 
> it is). 
>
> If I were you I'd start with a quick evaluation of the existing code 
> to determine if you think it is worth the porting effort.  Porting 
> code you've written yourself from 0.96 to 1.0 is not particularly hard 
> since one can generally recall while reading through the 
> backwards-incompatible list "oh yeah I used that somewhere I 
> think"...porting someone else's code from that uses old constructs 
> never learned is a bit more of a chore.
>
> To answer the specific question about this import, validators are no 
> more, so there is no 'just change x to y' fix for this.  You'll need 
> to figure out what they were being used for (maybe they were tied into 
> some use of old forms/manipulators which I never used so I'm fuzzy on 
> them) and come up with a 1.0 replacement.  Newforms (now forms in 
> Django 1.0) has an entirely different way of doing form validation. 
>
> 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
-~--~~~~--~~--~--~---



Re: porting OpenBookPlatform to Django v1

2008-10-08 Thread Tonu Mikk

Here is a bit more info on the error that I am getting with 
OpenBookPlatform.

When I try to access booklist in OpenBookPlatform I received this error:
Exception Value: Could not import apps.books.views. Error was: cannot 
import name validators

Same error appears when I try to use the Register link:
Exception Value: Could not import apps.users.views.auth. Error was: 
cannot import name validators

I suspect that I am receiving this error because OpenBookPlatform was 
created in Django version 0.97 and it seems that the django validators 
have changes sufficiently between 1.0 and previous versions.
I see a line in views.py:  from django.core import validators .  I am 
wondering if I need to be using a different string here?

Thank you,
Tonu

Tonu Mikk wrote:
> Hello, I wonder if anyone has tried porting the OpenBookPlatform 
> http://djangosites.org/s/limodou-51boo-com/ to Django v1?  I am trying 
> this, but running into problems.  I contacted the project owner, but he 
> is not maintaining the code any more.
>
> Thank you,
> Tonu
>
> >
>   



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



porting OpenBookPlatform to Django v1

2008-10-08 Thread Tonu Mikk

Hello, I wonder if anyone has tried porting the OpenBookPlatform 
http://djangosites.org/s/limodou-51boo-com/ to Django v1?  I am trying 
this, but running into problems.  I contacted the project owner, but he 
is not maintaining the code any more.

Thank you,
Tonu

--~--~-~--~~~---~--~~
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: Apache virtual host setup trouble

2008-09-15 Thread Tonu Mikk

Looks like I got it figured out ...

The problem was in urls.py file in /var/www/polls/pollngo in this line:

urlpatterns = patterns('polls.views',

I changed it to

urlpatterns = patterns('polls.pollngo.views',

and it started to work!  Yey!


Tonu

Tonu Mikk wrote:
> Hello,
>
> I am trying to port a django project that is working with development 
> server to be served from Apache Virtual Host, but having some trouble 
> configuring the correct directories.  Any help is appreciated.  This is 
> with Django version 1, Apache 2.2 + mod_python.
>
> The virtual host is at polls.dmc.umn.edu .  It has following directives:
> DocumentRoot /var/www/polls
> ServerName polls.dmc.umn.edu
> 
> allow from all
> Options None
> 
> 
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> PythonPath "['/var/www'] + sys.path"
> SetEnv DJANGO_SETTINGS_MODULE polls.settings
> PythonDebug On
> 
>
> The root url in setting.py is  ROOT_URLCONF = 'polls.urls'
> The urls.py in /var/www/polls is
>
> from django.conf.urls.defaults import *
>
> urlpatterns = patterns('',
> # Example:
> (r'^', include('polls.pollngo.urls')),
>
> The urls.py in /var/www/polls/pollngo is
> from django.conf.urls.defaults import *
> from django.views.generic.simple import direct_to_template
>
> urlpatterns = patterns('polls.views',
> (r'^$', 'index'),
> (r'^poll/(?P[^\.^/]+)/$', 'question'),
> (r'^create/$', 'create'),
> (r'^help/$', 'help'),
> (r'^results/(?P[^\.^/]+)/$', 'results'),
> )
>
>
> The views.py file is in /var/www/polls/pollngo
>
> When I access the page, I get:
> Environment:
>
> Request Method: GET
> Request URL: http://polls.dmc.umn.edu/
> Django Version: 1.0-final-SVN-unknown
> Python Version: 2.5.1
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.admin',
>  'polls.pollngo']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.middleware.doc.XViewMiddleware')
>
>
> Traceback:
> File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" in 
> get_response
>   77. request.path_info)
> File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py" in 
> resolve
>   180. sub_match = pattern.resolve(new_path)
> File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py" in 
> resolve
>   180. sub_match = pattern.resolve(new_path)
> File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py" in 
> resolve
>   123. return self.callback, args, kwargs
> File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py" in 
> _get_callback
>   132. raise ViewDoesNotExist, "Could not import %s. Error 
> was: %s" % (mod_name, str(e))
>
> Exception Type: ViewDoesNotExist at /
> Exception Value: Could not import polls.views. Error was: No module 
> named views
>
>
> >
>   


-- 
Tonu Mikk
Educational Technology Consultant
Digital Media Center - dmc.umn.edu
[EMAIL PROTECTED] 612 625-9221


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



Apache virtual host setup trouble

2008-09-15 Thread Tonu Mikk

Hello,

I am trying to port a django project that is working with development 
server to be served from Apache Virtual Host, but having some trouble 
configuring the correct directories.  Any help is appreciated.  This is 
with Django version 1, Apache 2.2 + mod_python.

The virtual host is at polls.dmc.umn.edu .  It has following directives:
DocumentRoot /var/www/polls
ServerName polls.dmc.umn.edu

allow from all
Options None


SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['/var/www'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE polls.settings
PythonDebug On


The root url in setting.py is  ROOT_URLCONF = 'polls.urls'
The urls.py in /var/www/polls is

from django.conf.urls.defaults import *

urlpatterns = patterns('',
# Example:
(r'^', include('polls.pollngo.urls')),

The urls.py in /var/www/polls/pollngo is
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template

urlpatterns = patterns('polls.views',
(r'^$', 'index'),
(r'^poll/(?P[^\.^/]+)/$', 'question'),
(r'^create/$', 'create'),
(r'^help/$', 'help'),
(r'^results/(?P[^\.^/]+)/$', 'results'),
)


The views.py file is in /var/www/polls/pollngo

When I access the page, I get:
Environment:

Request Method: GET
Request URL: http://polls.dmc.umn.edu/
Django Version: 1.0-final-SVN-unknown
Python Version: 2.5.1
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'polls.pollngo']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware')


Traceback:
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" in 
get_response
  77. request.path_info)
File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py" in 
resolve
  180. sub_match = pattern.resolve(new_path)
File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py" in 
resolve
  180. sub_match = pattern.resolve(new_path)
File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py" in 
resolve
  123. return self.callback, args, kwargs
File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py" in 
_get_callback
  132. raise ViewDoesNotExist, "Could not import %s. Error 
was: %s" % (mod_name, str(e))

Exception Type: ViewDoesNotExist at /
Exception Value: Could not import polls.views. Error was: No module 
named views


--~--~-~--~~~---~--~~
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: Apache and mod_python trouble

2008-09-12 Thread Tonu Mikk

Karen Tracey wrote:
> On Fri, Sep 12, 2008 at 11:47 AM, Tonu Mikk <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> Hello,
>
> I am having trouble configuring Apache and mod_python to work with my
> project.
>
> I am using Ubuntu Linux 7.10 with Apache 2.  My project is in
> /var/www/polls directory.  This is also where the settings.py file is.
> This directory and all files and directories are owned by
>  www-data (the
> user under which Apache is running) and they have 755 rights.
>
> I have configured Apache httpd.conf file like so (only relevant parts
> are included):
>
>
>Order allow,deny
>allow from all
>
>
> 
>SetHandler python-program
>PythonHandler django.core.handlers.modpython
>PythonPath "['/var/www/polls'] + sys.path"
>SetEnv DJANGO_SETTINGS_MODULE polls.settings
>PythonDebug On
> 
>
> I am getting the following error when I access
> ciaran.dmc.umn.edu/polls <http://ciaran.dmc.umn.edu/polls>
> ImportError: Could not import settings 'polls.settings' (Is it on
> sys.path? Does it have syntax errors?): No module named polls.settings
>
>
> You either want to have '/var/www' in PythonPath or specify 
> DJANGO_SETTINGS_MODULE as just settings, not polls.settings. As it is 
> now Python will be looking for /var/www/polls/polls/settings.py (then 
> searching the rest of sys.path for it when it's not found).
>
> Which one you want rather depends on the imports you use in the rest 
> of your project. If you import from 'polls.whatever' then you need 
> '/var/www' in PythonPath.  If you omit the 'polls' part in your 
> imports, then you need '/var/www/polls' in your PyrhonPath.
Karen, thank you.  I changed my Location directive to


SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['/var/www'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE polls.settings
PythonDebug On


I am now able to get past the previous error.  However, I now get the 
error about URLConf.  I was able to run the project on the development 
server with the current URL configuration.  I am not quite sure what I 
need to change in my URLConf file.  Thanks for your help.

Tonu


  Page not found (404)

Request Method: GET
Request URL:http://ciaran.dmc.umn.edu/polls/

Using the URLconf defined in |polls.urls|, Django tried these URL 
patterns, in this order:

   1. ^ ^$
   2. ^ ^poll/(?P[^\.^/]+)/$
   3. ^ ^create/$
   4. ^ ^help/$
   5. ^ ^results/(?P[^\.^/]+)/$
   6. ^ ^admin/
   7. ^ ^site_media/(?P.*)$
   8. ^admin/

The current URL, |polls/|, didn't match any of these.

The URLConf in polls/directory is following:

from django.conf.urls.defaults import *

urlpatterns = patterns('',
# Example:
(r'^', include('polls.pollngo.urls')),

# Uncomment this for admin:
(r'^admin/', include('django.contrib.admin.urls')),
)


The URLConfi in pollngo directory is following:

from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template

urlpatterns = patterns('pollngo.views',
(r'^$', 'index'),
(r'^poll/(?P[^\.^/]+)/$', 'question'),
(r'^create/$', 'create'),
(r'^help/$', 'help'),
(r'^results/(?P[^\.^/]+)/$', 'results'),
)

urlpatterns += patterns('',
(r'^admin/', include('django.contrib.admin.urls')),
)



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



Apache and mod_python trouble

2008-09-12 Thread Tonu Mikk

Hello,

I am having trouble configuring Apache and mod_python to work with my 
project.

I am using Ubuntu Linux 7.10 with Apache 2.  My project is in 
/var/www/polls directory.  This is also where the settings.py file is.  
This directory and all files and directories are owned by  www-data (the 
user under which Apache is running) and they have 755 rights.

I have configured Apache httpd.conf file like so (only relevant parts 
are included):


Order allow,deny
allow from all



SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['/var/www/polls'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE polls.settings
PythonDebug On


I am getting the following error when I access ciaran.dmc.umn.edu/polls 
.  Any help is appreciated.

Thanks, Tonu

MOD_PYTHON ERROR

ProcessId:  13754
Interpreter:'ciaran.dmc.umn.edu'

ServerName: 'ciaran.dmc.umn.edu'
DocumentRoot:   '/var/www/'

URI:'/polls/'
Location:   '/polls/'
Directory:  None
Filename:   '/var/www/polls/'
PathInfo:   ''

Phase:  'PythonHandler'
Handler:'django.core.handlers.modpython'

Traceback (most recent call last):

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in 
HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in 
_process_target
result = _execute_target(config, req, object, arg)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in 
_execute_target
result = object(arg)

  File "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py", 
line 222, in handler
return ModPythonHandler()(req)

  File "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py", 
line 185, in __call__
self.load_middleware()

  File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py", line 
31, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:

  File "/usr/lib/python2.5/site-packages/django/conf/__init__.py", line 28, in 
__getattr__
self._import_settings()

  File "/usr/lib/python2.5/site-packages/django/conf/__init__.py", line 59, in 
_import_settings
self._target = Settings(settings_module)

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

ImportError: Could not import settings 'polls.settings' (Is it on sys.path? 
Does it have syntax errors?): No module named polls.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
-~--~~~~--~~--~--~---



Re: template questions

2008-09-08 Thread Tonu Mikk

I got it figured out after getting the Documentation link to work in 
Admin pages.  The documentation helped me to see that I can refer to the 
polls by {{poll.id}} in my template.

Tonu Mikk wrote:
> These are probably an extreme newby questions, but I cannot figure it out.
>
> 1.  I am working through the tutorial for building a Polls application.  
> On part 3 it talks about creating public views for the applications.  I 
> would like to modify the index template to present a list of polls and 
> have the polls linked to the details about the polls (ie the details 
> view at a Url polls/1/.  How could I do that?
>   
Create a URL like so:  {{poll.question}}
> 2.  In my  Admin site I do not see a link to Documentation in the upper 
> right hand corner.  How could I get it there?
>
>   
Modified the URLConf file to include the admindocs and included the 
admindocs application in the settings.py file.  That produced a link.  
Once I had that, I needed to install python docs library. 
> Thank you,
> Tonu
>
> >
>   



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



template questions

2008-09-08 Thread Tonu Mikk

These are probably an extreme newby questions, but I cannot figure it out.

1.  I am working through the tutorial for building a Polls application.  
On part 3 it talks about creating public views for the applications.  I 
would like to modify the index template to present a list of polls and 
have the polls linked to the details about the polls (ie the details 
view at a Url polls/1/.  How could I do that?

2.  In my  Admin site I do not see a link to Documentation in the upper 
right hand corner.  How could I get it there?

Thank you,
Tonu

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