Problem with custom tags
My project is in folder: webinterface/ I have defined a custom "webinterface_tags.py" inside my project: webinterface/templatetags/webinterface_tags.py My webinterface/settings.py says: INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.templatetags', # done 11 nov ) I have included a {% load webinterface_tags %}statement in a template/search.html file. But while running this application on django on apache server, django is not able to find webinterface_tags file. Response is: 'webinterface_tags' is not a valid tag library: Could not load template library from django.templatetags.webinterface_tags, No module named webinterface_tags Am i missing any of the settings which I need to do for webinterface/ templatetags directory ? I checked online, but there is not any concrete example. Kindly help! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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 mod_python under apache
I have configured Django with mod_python under apache web server. I would like to know, where can i see the print statements output for debugging which i put in python files in django views. I dont think print statement appears in Apache logs ... -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.
[Newbie] Console output using runserver..
I have been working on a simple project. I use Django app server and use it like: ## C:\search\pysolr\webinterface>python manage.py runserver 8081 Validating models... 0 errors found Django version 1.0.2 final, using settings 'webinterface.settings' Development server is running at http://127.0.0.1:8081/ Quit the server with CTRL-BREAK. ## Few months back, when i used this command, and any of my python view files used "print" statements for debugging, I would get the output in this command prompt window. But, nowadays, when i fire this command, my print outputs are not coming on the screen. Could anyone tell me what I am doing wrong ? thanks. -- 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: Console output using runserver..
This is what Django webpage is showing as error: OperationalError at /ner/ no such table: b_mp_TABLE Request Method: POST Request URL:http://localhost/ner/ Exception Type: OperationalError Exception Value: no such table: b_mp_TABLE Exception Location: C:/lilly-search/pySolr\webinterface\api\ner.py in get_more_words_per_entity, line 75 Python Executable: C:\Program Files\Apache Software Foundation \Apache2.2\bin\httpd.exe Python Version: 2.5.4 Python Path:['C:\\Python25\\Lib\\site-packages\\setuptools-0.6c11- py2.5.egg', 'C:\\Python25\\Lib\\site-packages\\sparqlwrapper-1.4.2- py2.5.egg', 'C:\\Python25\\Lib\\site-packages\\simplejson-2.0.9-py2.5- win32.egg', 'C:\\Python25\\Lib\\site-packages\\rdflib-3.1.0- py2.5.egg', 'C:\\Python25\\Lib\\site-packages\\django', 'C:\\Python25\ \Lib\\site-packages', 'C:\\Program Files\\Apache Software Foundation\ \Apache2.2', 'C:\\WINDOWS\\system32\\python25.zip', 'C:\\Python25\ \Lib', 'C:\\Python25\\DLLs', 'C:\\Python25\\Lib\\lib-tk', 'C:\\Program Files\\Apache Software Foundation\\Apache2.2\\bin', 'C:\\Python25', 'C:/lilly-search/pySolr', 'C:/Django-1.0.2-final'] Server time:Sat, 3 Dec 2011 15:39:48 -0800 Is something wrong with apache ? Is apache not allowed to read the db file which I have ? -- 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: Console output using runserver..
I just figured out that if I use : http://127.0.0.1:8081/ner/ then I am getting print output in console, but if I use: http://localhost:8081/ner/ then i am not getting the output Whats the reason behind this / ?? On Dec 3, 12:34 pm, vivek_12315 wrote: > This is what Django webpage is showing as error: > > > OperationalError at /ner/ > > no such table: b_mp_TABLE > > Request Method: POST > Request URL: http://localhost/ner/ > Exception Type: OperationalError > Exception Value: > > no such table: b_mp_TABLE > > Exception Location: C:/lilly-search/pySolr\webinterface\api\ner.py in > get_more_words_per_entity, line 75 > Python Executable: C:\Program Files\Apache Software Foundation > \Apache2.2\bin\httpd.exe > Python Version: 2.5.4 > Python Path: ['C:\\Python25\\Lib\\site-packages\\setuptools-0.6c11- > py2.5.egg', 'C:\\Python25\\Lib\\site-packages\\sparqlwrapper-1.4.2- > py2.5.egg', 'C:\\Python25\\Lib\\site-packages\\simplejson-2.0.9-py2.5- > win32.egg', 'C:\\Python25\\Lib\\site-packages\\rdflib-3.1.0- > py2.5.egg', 'C:\\Python25\\Lib\\site-packages\\django', 'C:\\Python25\ > \Lib\\site-packages', 'C:\\Program Files\\Apache Software Foundation\ > \Apache2.2', 'C:\\WINDOWS\\system32\\python25.zip', 'C:\\Python25\ > \Lib', 'C:\\Python25\\DLLs', 'C:\\Python25\\Lib\\lib-tk', 'C:\\Program > Files\\Apache Software Foundation\\Apache2.2\\bin', 'C:\\Python25', > 'C:/lilly-search/pySolr', 'C:/Django-1.0.2-final'] > Server time: Sat, 3 Dec 2011 15:39:48 -0800 > > > > Is something wrong with apache ? Is apache not allowed to read the db > file which I have ? -- 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.
Problem with simple file upload.
I am a beginner in Django programming. I am writing a simple module for file upload looking at link: http://docs.djangoproject.com/en/dev/topics/http/file-uploads/?from=olddocs I have made a view = upload.py and corresponding html = upload.html. Its content are as follows: ~upload.py~~~ from django import forms from django.http import HttpResponseRedirect from django.shortcuts import render_to_response # Imaginary function to handle an uploaded file. #from somewhere import handle_uploaded_file class UploadFileForm(forms.Form): title = forms.CharField(max_length=100) file = forms.FileField() def upload_file(request): if request.method == 'POST': form = UploadFileForm(request.POST, request.FILES) if form.is_valid(): handle_uploaded_file(request.FILES['file']) html = "success in upload " return HttpResponseRedirect(html) else: form = UploadFileForm() return render_to_response('upload.html', {'form': form}) def handle_uploaded_file(f): destination = open('/home/bluegene/doom.txt', 'wb+') for chunk in f.chunks(): destination.write(chunk) destination.close() end ~upload.html~~~ ---Upload--- Documents Please enter the /path/name/of/directory containing the documents to be indexed. end When I browse for the file and hit 'upload' button, the shell shows a POST request like: [21/Dec/2010 16:31:32] "POST /index/ HTTP/1.1" 200 437 but I don't get a new file named "doom.txt" which I should. Is there something wrong in my code ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Problem with simple file upload.
Awaiting reply! On Dec 22, 3:36 am, vivek_12315 wrote: > I am a beginner in Django programming. I am writing a simple module > for file upload looking at link: > > http://docs.djangoproject.com/en/dev/topics/http/file-uploads/?from=o... > > I have made a view = upload.py and corresponding html = upload.html. > > Its content are as follows: > > ~upload.py~~~ > > from django import > forms > from django.http import HttpResponseRedirect > from django.shortcuts import render_to_response > > # Imaginary function to handle an uploaded file. > #from somewhere import handle_uploaded_file > class UploadFileForm(forms.Form): > title = forms.CharField(max_length=100) > file = forms.FileField() > > def upload_file(request): > if request.method == 'POST': > form = UploadFileForm(request.POST, request.FILES) > if form.is_valid(): > handle_uploaded_file(request.FILES['file']) > html = "success in upload " > return HttpResponseRedirect(html) > else: > form = UploadFileForm() > return render_to_response('upload.html', {'form': form}) > > def handle_uploaded_file(f): > destination = open('/home/bluegene/doom.txt', 'wb+') > for chunk in f.chunks(): > destination.write(chunk) > destination.close() > > end > > ~upload.html~~~ > > > > > ---Upload--- Documents > > > > > > > Please enter the /path/name/of/directory containing > the documents to be indexed. > > > > > > html> > > end > > When I browse for the file and hit 'upload' button, the shell shows a > POST request like: > > [21/Dec/2010 16:31:32] "POST /index/ HTTP/1.1" 200 437 > > but I don't get a new file named "doom.txt" which I should. > > Is there something wrong in my code ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Problem with simple file upload.
If I use print statements in view python files, where can I see the output ? I am using django dev. server for initial testing of my website On Dec 22, 1:18 pm, yiftah wrote: > Nick is right, you need to change your view code to > handle_uploaded_file(request.FILES['uploaded']) > instead of > handle_uploaded_file(request.FILES['file']) > > I'm not sure a request object can process a file upload > you may need to use RequestContext in your view definition > > On Dec 22, 7:50 pm, Nick Serra wrote: > > > I'm too lazy to check, but i'm pretty sure the name of your file input > > needs to match the name of the form field. Also, try troubleshooting. > > Use print statements in the view to see if the file object is being > > posted, etc. > > > On Dec 21, 11:54 pm, vivek_12315 wrote: > > > > Awaiting reply! > > > > On Dec 22, 3:36 am, vivek_12315 wrote: > > > > > I am a beginner in Django programming. I am writing a simple module > > > > for file upload looking at link: > > > > >http://docs.djangoproject.com/en/dev/topics/http/file-uploads/?from=o... > > > > > I have made a view = upload.py and corresponding html = upload.html. > > > > > Its content are as follows: > > > > > ~upload.py~~~ > > > > > from django import > > > > forms > > > > from django.http import HttpResponseRedirect > > > > from django.shortcuts import render_to_response > > > > > # Imaginary function to handle an uploaded file. > > > > #from somewhere import handle_uploaded_file > > > > class UploadFileForm(forms.Form): > > > > title = forms.CharField(max_length=100) > > > > file = forms.FileField() > > > > > def upload_file(request): > > > > if request.method == 'POST': > > > > form = UploadFileForm(request.POST, request.FILES) > > > > if form.is_valid(): > > > > handle_uploaded_file(request.FILES['file']) > > > > html = "success in upload " > > > > return HttpResponseRedirect(html) > > > > else: > > > > form = UploadFileForm() > > > > return render_to_response('upload.html', {'form': form}) > > > > > def handle_uploaded_file(f): > > > > destination = open('/home/bluegene/doom.txt', 'wb+') > > > > for chunk in f.chunks(): > > > > destination.write(chunk) > > > > destination.close() > > > > > end > > > > > ~upload.html~~~ > > > > > > > > > > > > > > > > > > > > ---Upload--- Documents > > > > > > > > > > > > > > > > > > > > > > > > > > > > Please enter the /path/name/of/directory containing > > > > the documents to be indexed. > > > > > > > > > > > > > > > > > > > > > > > > html> > > > > > end > > > > > When I browse for the file and hit 'upload' button, the shell shows a > > > > POST request like: > > > > > [21/Dec/2010 16:31:32] "POST /index/ HTTP/1.1" 200 437 > > > > > but I don't get a new file named "doom.txt" which I should. > > > > > Is there something wrong in my code ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Problem with simple file upload.
If I use print statements in view python files, where can I see the output ? I am using django dev. server for initial testing of my website On Dec 22, 1:18 pm, yiftah wrote: > Nick is right, you need to change your view code to > handle_uploaded_file(request.FILES['uploaded']) > instead of > handle_uploaded_file(request.FILES['file']) > > I'm not sure a request object can process a file upload > you may need to use RequestContext in your view definition > > On Dec 22, 7:50 pm, Nick Serra wrote: > > > I'm too lazy to check, but i'm pretty sure the name of your file input > > needs to match the name of the form field. Also, try troubleshooting. > > Use print statements in the view to see if the file object is being > > posted, etc. > > > On Dec 21, 11:54 pm, vivek_12315 wrote: > > > > Awaiting reply! > > > > On Dec 22, 3:36 am, vivek_12315 wrote: > > > > > I am a beginner in Django programming. I am writing a simple module > > > > for file upload looking at link: > > > > >http://docs.djangoproject.com/en/dev/topics/http/file-uploads/?from=o... > > > > > I have made a view = upload.py and corresponding html = upload.html. > > > > > Its content are as follows: > > > > > ~upload.py~~~ > > > > > from django import > > > > forms > > > > from django.http import HttpResponseRedirect > > > > from django.shortcuts import render_to_response > > > > > # Imaginary function to handle an uploaded file. > > > > #from somewhere import handle_uploaded_file > > > > class UploadFileForm(forms.Form): > > > > title = forms.CharField(max_length=100) > > > > file = forms.FileField() > > > > > def upload_file(request): > > > > if request.method == 'POST': > > > > form = UploadFileForm(request.POST, request.FILES) > > > > if form.is_valid(): > > > > handle_uploaded_file(request.FILES['file']) > > > > html = "success in upload " > > > > return HttpResponseRedirect(html) > > > > else: > > > > form = UploadFileForm() > > > > return render_to_response('upload.html', {'form': form}) > > > > > def handle_uploaded_file(f): > > > > destination = open('/home/bluegene/doom.txt', 'wb+') > > > > for chunk in f.chunks(): > > > > destination.write(chunk) > > > > destination.close() > > > > > end > > > > > ~upload.html~~~ > > > > > > > > > > > > > > > > > > > > ---Upload--- Documents > > > > > > > > > > > > > > > > > > > > > > > > > > > > Please enter the /path/name/of/directory containing > > > > the documents to be indexed. > > > > > > > > > > > > > > > > > > > > > > > > html> > > > > > end > > > > > When I browse for the file and hit 'upload' button, the shell shows a > > > > POST request like: > > > > > [21/Dec/2010 16:31:32] "POST /index/ HTTP/1.1" 200 437 > > > > > but I don't get a new file named "doom.txt" which I should. > > > > > Is there something wrong in my code ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Problem with simple file upload.
Never mind I am able to see print statements in dev server shell output There is some problem with my upload.html as the 'form' variable returned by python script is not used at html end... This e.g. helped me much : http://www.zoia.org/blog/2007/07/29/django-file-upload/ On Dec 25, 11:29 pm, vivek_12315 wrote: > If I use print statements in view python files, where can I see the > output ? I am using django dev. server for initial testing of my > website > > On Dec 22, 1:18 pm, yiftah wrote: > > > Nick is right, you need to change your view code to > > handle_uploaded_file(request.FILES['uploaded']) > > instead of > > handle_uploaded_file(request.FILES['file']) > > > I'm not sure a request object can process a file upload > > you may need to use RequestContext in your view definition > > > On Dec 22, 7:50 pm, Nick Serra wrote: > > > > I'm too lazy to check, but i'm pretty sure the name of your file input > > > needs to match the name of the form field. Also, try troubleshooting. > > > Use print statements in the view to see if the file object is being > > > posted, etc. > > > > On Dec 21, 11:54 pm, vivek_12315 wrote: > > > > > Awaiting reply! > > > > > On Dec 22, 3:36 am, vivek_12315 wrote: > > > > > > I am a beginner in Django programming. I am writing a simple module > > > > > for file upload looking at link: > > > > > >http://docs.djangoproject.com/en/dev/topics/http/file-uploads/?from=o... > > > > > > I have made a view = upload.py and corresponding html = upload.html. > > > > > > Its content are as follows: > > > > > > ~upload.py~~~ > > > > > > from django import > > > > > forms > > > > > from django.http import HttpResponseRedirect > > > > > from django.shortcuts import render_to_response > > > > > > # Imaginary function to handle an uploaded file. > > > > > #from somewhere import handle_uploaded_file > > > > > class UploadFileForm(forms.Form): > > > > > title = forms.CharField(max_length=100) > > > > > file = forms.FileField() > > > > > > def upload_file(request): > > > > > if request.method == 'POST': > > > > > form = UploadFileForm(request.POST, request.FILES) > > > > > if form.is_valid(): > > > > > handle_uploaded_file(request.FILES['file']) > > > > > html = "success in upload " > > > > > return HttpResponseRedirect(html) > > > > > else: > > > > > form = UploadFileForm() > > > > > return render_to_response('upload.html', {'form': form}) > > > > > > def handle_uploaded_file(f): > > > > > destination = open('/home/bluegene/doom.txt', 'wb+') > > > > > for chunk in f.chunks(): > > > > > destination.write(chunk) > > > > > destination.close() > > > > > > end > > > > > > ~upload.html~~~ > > > > > > > > > > > > > > > > > > > > > > > > > ---Upload--- Documents > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Please enter the /path/name/of/directory containing > > > > > the documents to be indexed. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > html> > > > > > > end > > > > > > When I browse for the file and hit 'upload' button, the shell shows a > > > > > POST request like: > > > > > > [21/Dec/2010 16:31:32] "POST /index/ HTTP/1.1" 200 437 > > > > > > but I don't get a new file named "doom.txt" which I should. > > > > > > Is there something wrong in my code ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Problem with simple file upload.
Never mind I am able to see print statements in dev server shell output There is some problem with my upload.html as the 'form' variable returned by python script is not used at html end... This e.g. helped me much : http://www.zoia.org/blog/2007/07/29/django-file-upload/ On Dec 25, 11:29 pm, vivek_12315 wrote: > If I use print statements in view python files, where can I see the > output ? I am using django dev. server for initial testing of my > website > > On Dec 22, 1:18 pm, yiftah wrote: > > > Nick is right, you need to change your view code to > > handle_uploaded_file(request.FILES['uploaded']) > > instead of > > handle_uploaded_file(request.FILES['file']) > > > I'm not sure a request object can process a file upload > > you may need to use RequestContext in your view definition > > > On Dec 22, 7:50 pm, Nick Serra wrote: > > > > I'm too lazy to check, but i'm pretty sure the name of your file input > > > needs to match the name of the form field. Also, try troubleshooting. > > > Use print statements in the view to see if the file object is being > > > posted, etc. > > > > On Dec 21, 11:54 pm, vivek_12315 wrote: > > > > > Awaiting reply! > > > > > On Dec 22, 3:36 am, vivek_12315 wrote: > > > > > > I am a beginner in Django programming. I am writing a simple module > > > > > for file upload looking at link: > > > > > >http://docs.djangoproject.com/en/dev/topics/http/file-uploads/?from=o... > > > > > > I have made a view = upload.py and corresponding html = upload.html. > > > > > > Its content are as follows: > > > > > > ~upload.py~~~ > > > > > > from django import > > > > > forms > > > > > from django.http import HttpResponseRedirect > > > > > from django.shortcuts import render_to_response > > > > > > # Imaginary function to handle an uploaded file. > > > > > #from somewhere import handle_uploaded_file > > > > > class UploadFileForm(forms.Form): > > > > > title = forms.CharField(max_length=100) > > > > > file = forms.FileField() > > > > > > def upload_file(request): > > > > > if request.method == 'POST': > > > > > form = UploadFileForm(request.POST, request.FILES) > > > > > if form.is_valid(): > > > > > handle_uploaded_file(request.FILES['file']) > > > > > html = "success in upload " > > > > > return HttpResponseRedirect(html) > > > > > else: > > > > > form = UploadFileForm() > > > > > return render_to_response('upload.html', {'form': form}) > > > > > > def handle_uploaded_file(f): > > > > > destination = open('/home/bluegene/doom.txt', 'wb+') > > > > > for chunk in f.chunks(): > > > > > destination.write(chunk) > > > > > destination.close() > > > > > > end > > > > > > ~upload.html~~~ > > > > > > > > > > > > > > > > > > > > > > > > > ---Upload--- Documents > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Please enter the /path/name/of/directory containing > > > > > the documents to be indexed. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > html> > > > > > > end > > > > > > When I browse for the file and hit 'upload' button, the shell shows a > > > > > POST request like: > > > > > > [21/Dec/2010 16:31:32] "POST /index/ HTTP/1.1" 200 437 > > > > > > but I don't get a new file named "doom.txt" which I should. > > > > > > Is there something wrong in my code ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.
Any Django framework command to freeze/wait/notify ?
Hi all, This is a common scenario which many of you have faced. Say, I created a simple view file, in which user uploads a file and does some processing at backend and after processing is finished I am rendering a html page with some processed result. My problem is that, there should be some kind of a mechanism, by which I can notify user that "processing is going in background, so please wait till the processing finished." So, what are the easy to implement options I have ? Does Django provides something for these scenario ? Will javascript (timer mechanism) work ? Comment/suggestions ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.
Location for generating temporary files
Hello all, while coding for views in django, i feel the need of generating files, more like logs. But i want all those logs to be generated in a specific directory. So, can I use my settings.py file for defining such a location of dir. and in views files' i can refer to that settings value some how ? Is there a way for this ? Does settings.py allow only standard settings to be defined ? -- 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.