Re: Problems installing my first django app

2013-05-12 Thread gilberto dos santos alves
use command whereis django-admin.py (ubuntu, fedora, centos etc) put this 
on folder /usr/local/bin.
if whereis result not found use another command: find / -iname 
'django-admin*'and you will see all files that begin with django-admin 
(* is coringa)

Em domingo, 12 de maio de 2013 05h59min29s UTC-3, lastripas records 
escreveu:
>
> I've followed the tutorial for building my first app on django.
> I run all the comands via ssh to my remote server.
>
> I make a directory on my server into 'public_html' default directory.
> Then on this folder I run the comand django-admin.py startproject mysite
>
> When I try to run the manage.py...it gives me some error '-jailshell: 
> manage.py: command not found'
>
> By the way the directory seems to have only the manage.py file...
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django and apache

2013-05-12 Thread Venkatraman S
Set STATIC_ROOT in your settings.py and run 'collectstatic'.
You need not mention in your /static/admin
/usr/lib/python2.7/dist-packages/django/contrib/admin/static/admin in your
apache conf then.

On Mon, May 13, 2013 at 7:16 AM, Stanley Agba wrote:

> Thanks Guys,
> The server is up and running with mod_wsgi, tho the admin page is not
> loading with the static files.
> I have added this to my apache.conf file:
>  Alias /static/admin
> /usr/lib/python2.7/dist-packages/django/contrib/admin/static/admin
> Kind of stuck after this
>
>
>
> On Sunday, 12 May 2013 11:17:04 UTC+1, Stanley Agba wrote:
>>
>> Hello guys,
>> please I'm kind of a noob at django and I'm trying to deploy a django
>> site on Apache with mod_wsgi, I am not using a virtualenv as the server has
>> python installed.
>> I added the following to my /etc/apache2/apache2.conf
>>
>> 
>>ServerName example
>>ServerAlias example
>>ServerAdmin exam...@example.com
>>
>>DocumentRoot /var/www/example/static
>>WSGIScriptAlias / /var/www/example/example/wsgi.**py
>>WSGIPythonPath  /var/www/example
>>
>>
>>   Order allow,deny
>>   Allow from all
>>
>>
>>
>>Alias /head.jpg  /var/www/example/static/head.**jpg
>>Alias /media/ /var/www/example/uploads
>>Alias /static /var/www/example/static
>>
>>
>>Order deny,allow
>>Allow from all
>>
>>
>>   
>>   Order deny,allow
>>   Allow from all
>>   
>>
>>   ErrorLog /var/www/python_ng/logs/error.**log
>>   CustomLog /var/www/python_ng/logs/**access.log combined
>> 
>>
>> I got a 'WSGIPythonPath cannot be in virtual host section' error.
>> I have searched for previous topics but i have not been able to get a
>> solution, I would greatly appreciate any help.
>> Thanks
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django and apache

2013-05-12 Thread Stanley Agba
Thanks Guys,
The server is up and running with mod_wsgi, tho the admin page is not 
loading with the static files.
I have added this to my apache.conf file:
 Alias /static/admin 
/usr/lib/python2.7/dist-packages/django/contrib/admin/static/admin
Kind of stuck after this



On Sunday, 12 May 2013 11:17:04 UTC+1, Stanley Agba wrote:
>
> Hello guys, 
> please I'm kind of a noob at django and I'm trying to deploy a django site 
> on Apache with mod_wsgi, I am not using a virtualenv as the server has 
> python installed.
> I added the following to my /etc/apache2/apache2.conf 
>
> 
>ServerName example
>ServerAlias example
>ServerAdmin exam...@example.com
>
>DocumentRoot /var/www/example/static
>WSGIScriptAlias / /var/www/example/example/wsgi.py
>WSGIPythonPath  /var/www/example
>
>
>   Order allow,deny
>   Allow from all
>
>
>
>Alias /head.jpg  /var/www/example/static/head.jpg
>Alias /media/ /var/www/example/uploads
>Alias /static /var/www/example/static
>
>
>Order deny,allow
>Allow from all
>
>
>   
>   Order deny,allow
>   Allow from all
>   
>
>   ErrorLog /var/www/python_ng/logs/error.log
>   CustomLog /var/www/python_ng/logs/access.log combined
> 
>
> I got a 'WSGIPythonPath cannot be in virtual host section' error.
> I have searched for previous topics but i have not been able to get a 
> solution, I would greatly appreciate any help.
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Django 1.4.4 HttpResponseRedirect to a PUT causing a second PUT?

2013-05-12 Thread John
I have an endpoint for renaming an object. After the update occurs, the 
view function returns an HttpResponseRedirect to redirect the client to the 
restful endpoint now representing that object (since it has been renamed). 
The update is a PUT.  I expect the 302 redirect to cause my browser to 
issue a GET, and it appears from Chrome that this is what it is issuing. 
 However, in my Django server terminal as well as the HTTP error page which 
comes back as a response, the server thinks its getting a PUT at the new 
and correct path.

1. Who is telling the truth!?
2. I expect that it should be doing a GET based on the way 302 works.

Thanks for help in solving this.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: HttpResponse.has_header

2013-05-12 Thread Larry Martell
On Sat, May 11, 2013 at 9:04 PM, Larry Martell  wrote:
> On Sat, May 11, 2013 at 9:08 AM, Masklinn  wrote:
>>
>> On 2013-05-11, at 17:01 , Larry Martell wrote:
>>
>>> On Sat, May 11, 2013 at 8:23 AM, Masklinn  wrote:
 On 2013-05-11, at 15:57 , Larry Martell wrote:
>
> Yes, that is what I did. This is not in my urlconf. It's in a view
> function. I replaced:
>
> return direct_to_template(request, template)
>
> by:
>
> return TemplateView.as_view(template_name=template)
>
> Is that not correct?

 Indeed not, `TemplateView.as_view(template)` is roughly equivalent to
 `functools.partial(direct_to_template, template=template)`: it's only
 one half of the operation, which returns a callable replying to
 requests.

 You need something along the lines of 
 `TemplateView.as_view(template)(request)`
>>>
>>> I appreciate all the assistance. I tried that and got:
>>>
>>> TypeError: as_view() takes exactly 1 argument (2 given)
>>>
>>
>> Oh yeah, you need to pass it as the keyword argument "template_name"
>> sorry about that. Basically take your code and add "(request)" at the
>> end.
>>
>> If the current request is a GET obviously.
>
> Thanks. That got me further along. I don't understand that syntax
> though. Never see that before.
>
> But now I'm having a NoReverseMatch issue that I don't get in 1.4.
> I'll have to dig into that on Monday.

Being OCD I couldn't wait until Monday ;-) The issue was that when I
was using direct_to_template I was passing in extra_context. You can't
do that with TemplateView. I had to subclass TemplateView and provide
my own get_context_data method. Now all I have to do is change the 52
usages of {% url ... %} to quote the first argument.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: HttpResponse.has_header

2013-05-12 Thread Larry Martell
On Sun, May 12, 2013 at 1:07 AM, Masklinn  wrote:
> On 12 mai 2013, at 05:04, Larry Martell  wrote:
>> On Sat, May 11, 2013 at 9:08 AM, Masklinn  wrote:
>>>
>>> On 2013-05-11, at 17:01 , Larry Martell wrote:
>>>
 On Sat, May 11, 2013 at 8:23 AM, Masklinn  wrote:
> On 2013-05-11, at 15:57 , Larry Martell wrote:
>>
>> Yes, that is what I did. This is not in my urlconf. It's in a view
>> function. I replaced:
>>
>> return direct_to_template(request, template)
>>
>> by:
>>
>> return TemplateView.as_view(template_name=template)
>>
>> Is that not correct?
>
> Indeed not, `TemplateView.as_view(template)` is roughly equivalent to
> `functools.partial(direct_to_template, template=template)`: it's only
> one half of the operation, which returns a callable replying to
> requests.
>
> You need something along the lines of 
> `TemplateView.as_view(template)(request)`

 I appreciate all the assistance. I tried that and got:

 TypeError: as_view() takes exactly 1 argument (2 given)
>>>
>>> Oh yeah, you need to pass it as the keyword argument "template_name"
>>> sorry about that. Basically take your code and add "(request)" at the
>>> end.
>>>
>>> If the current request is a GET obviously.
>>
>> Thanks. That got me further along. I don't understand that syntax
>> though. Never see that before.
>
> It's nothing more than a function returning a function, both being called in 
> sequence

Very cool. Never seen that before in python.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Use different apps or not?

2013-05-12 Thread Philippe Schraepen
Thanks for the clarification!
I'll definitely read the book! 

On Saturday, May 11, 2013 12:28:50 AM UTC, Lloyd Dube wrote:
>
> Hi Phillipe,
>
> I think that it really depends on how modular you would like your Django 
> project to be. Do you want the stats generation functionality to be 
> separately pluggable from the pie-charting functionality? Is your 
> gather_data app large enough (number of models) to warrant breaking it 
> down? If so, perhaps you could separate the apps. If not, you might want to 
> just have one.
>
> Django apps are really Python packages. Do not worry about how you will 
> pass data "between" them - if they are enabled in your INSTALLED_APPS 
> global variable in settings.py, they will be loaded and you can import each 
> from the other in your views.py file or wherever you need to import them, 
> then call functions from each as you require and pass the necessary 
> arguments.
>
> A good place to look for this sort of advice is Daniel Greenfeld and 
> Audrey Roy's new book found at https://django.2scoops.org/ (see Chapter 
> 4: ''Fundamentals of Django App Design") . In it, they say (quote): "In 
> essence, each app should be tightly focused on its task. If an app can’t be 
> explained in a single
> sentence of moderate length, or you need to say ‘and’ more than once, it 
> probably means the app is
> too big and should be broken up.
> "
>
>
> On Sat, May 11, 2013 at 12:45 AM, Philippe Schraepen <
> schraepen...@gmail.com > wrote:
>
>> Hi all,
>>
>> I'm new to Python and Django so don't be to hard on me please :)
>>
>> I'm writing a Django project which analyses your music folders, gives 
>> back statistics about it (like file-extentions, mp3 bitrate, number of 
>> unique artists,...) and generates pie charts of these stats. 
>>
>> My project currently consists of one 'gather_data' app which gathers the 
>> necessary stats-data from my music libary. Now I want to create pie charts 
>> of this data with the help of Mathplotlib. 
>>
>> Now here are my three questions:
>> -Should I create a new 'piechart' app to create the pie charts or should 
>> I just add another function to my first gather_data app? 
>> -If I should use a different app for this, how can I let Django load the 
>> first 'gather_data' app, and after this load the 'piechart' app?
>> -In case you guys recommend using a second app, should I move the data 
>> between the two apps with the help of session variables? 
>>
>> Thanks!
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> Regards,
> Sithu Lloyd Dube 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Can I use Connector/Python instead of MySQLdb? And how?

2013-05-12 Thread Vernon D. Cole


On Saturday, May 11, 2013 7:43:40 PM UTC-6, icedr...@gmail.com wrote:
>
> I am using Python 3.3.1 and Django 1.5.1. MySQLdb doesn't support Python 
> 3, so I want to use Connector/Python instead. But I don't know how to do 
> this.
>
> Is it easy to do this? If it is, how can I do this?
>
> Thanks.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Can I use Connector/Python instead of MySQLdb? And how?

2013-05-12 Thread Vernon D. Cole
The core developers are working on the problem as we speak.  I would 
suggest using either another database engine or Python 2.7 until they get 
it going.  I am guessing a few weeks, but that is only a guess.  If you do 
use Python 2.7 be sure to follow the suggestions to write your code as 3.3 
compatible -- from __future__ import print function -- etc.  Then you can 
switch back to Python 3.3 immediately when they have it fixed.
VDC

On Saturday, May 11, 2013 7:43:40 PM UTC-6, icedr...@gmail.com wrote:
>
> I am using Python 3.3.1 and Django 1.5.1. MySQLdb doesn't support Python 
> 3, so I want to use Connector/Python instead. But I don't know how to do 
> this.
>
> Is it easy to do this? If it is, how can I do this?
>
> Thanks.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django and apache

2013-05-12 Thread Venkatraman S
What i am going to suggest is totally orthogonal to your requirement as i
am not helping you with apace+mod_wsgi. Though this generally works, but i
think you should consider nginx if you are thinking about new deployments
or learning this skill.

And the reasons why i suggest nginx? Well..
1. extremely simple config file
2. my experiments showed me darn low cpu and memory consumption patterns.
...and many more that you will find on a quick web-search for 'nginx vs
apache'; but these were the primary motivators for me.

Also, i see nginx+uwsgi sits pretty well and is pretty easy to manage. I
also hear good things about gunicorn and it looks simple too. But i like
some of the features of uwsgi(like spooler) which makes me tilt towards it.

-V



On Sun, May 12, 2013 at 3:47 PM, Stanley Agba wrote:

> Hello guys,
> please I'm kind of a noob at django and I'm trying to deploy a django site
> on Apache with mod_wsgi, I am not using a virtualenv as the server has
> python installed.
> I added the following to my /etc/apache2/apache2.conf
>
> 
>ServerName example
>ServerAlias example
>ServerAdmin exam...@example.com
>
>DocumentRoot /var/www/example/static
>WSGIScriptAlias / /var/www/example/example/wsgi.py
>WSGIPythonPath  /var/www/example
>
>
>   Order allow,deny
>   Allow from all
>
>
>
>Alias /head.jpg  /var/www/example/static/head.jpg
>Alias /media/ /var/www/example/uploads
>Alias /static /var/www/example/static
>
>
>Order deny,allow
>Allow from all
>
>
>   
>   Order deny,allow
>   Allow from all
>   
>
>   ErrorLog /var/www/python_ng/logs/error.log
>   CustomLog /var/www/python_ng/logs/access.log combined
> 
>
> I got a 'WSGIPythonPath cannot be in virtual host section' error.
> I have searched for previous topics but i have not been able to get a
> solution, I would greatly appreciate any help.
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django and apache

2013-05-12 Thread Branko Majic
On Sun, 12 May 2013 03:17:04 -0700 (PDT)
Stanley Agba  wrote:

> Hello guys, 
> please I'm kind of a noob at django and I'm trying to deploy a django
> site on Apache with mod_wsgi, I am not using a virtualenv as the
> server has python installed.
> I added the following to my /etc/apache2/apache2.conf 
> 
> 
>ServerName example
>ServerAlias example
>ServerAdmin exam...@example.com
> 
>DocumentRoot /var/www/example/static
>WSGIScriptAlias / /var/www/example/example/wsgi.py
>WSGIPythonPath  /var/www/example
>
>
>   Order allow,deny
>   Allow from all
>
>
> 
>Alias /head.jpg  /var/www/example/static/head.jpg
>Alias /media/ /var/www/example/uploads
>Alias /static /var/www/example/static
> 
>
>Order deny,allow
>Allow from all
>
> 
>   
>   Order deny,allow
>   Allow from all
>   
> 
>   ErrorLog /var/www/python_ng/logs/error.log
>   CustomLog /var/www/python_ng/logs/access.log combined
> 
> 
> I got a 'WSGIPythonPath cannot be in virtual host section' error.
> I have searched for previous topics but i have not been able to get a 
> solution, I would greatly appreciate any help.
> Thanks

The WSGIPyhtonPath must be moved outside of the 
configuration directive. I.e. it must be in the "root" of Apache
configuration. For example, this would work:

%
WSGIPythonPath  /var/www/example

   ServerName example
   ServerAlias example
   ServerAdmin exam...@example.com

   DocumentRoot /var/www/example/static
   WSGIScriptAlias / /var/www/example/example/wsgi.py
   
   
  Order allow,deny
  Allow from all
   
   

   Alias /head.jpg  /var/www/example/static/head.jpg
   Alias /media/ /var/www/example/uploads
   Alias /static /var/www/example/static

   
   Order deny,allow
   Allow from all
   

  
  Order deny,allow
  Allow from all
  

  ErrorLog /var/www/python_ng/logs/error.log
  CustomLog /var/www/python_ng/logs/access.log combined

%

Keep in mind that setting the path in this way means it gets set like
that for _all_ mod_wsgi apps you might have. Most people therefore use
a bit different solution where they set-up the Python path within the
wsgi.py instead (if you want to host multiple independent
Django projects).

Best regards

-- 
Branko Majic
Jabber: bra...@majic.rs
Please use only Free formats when sending attachments to me.

Бранко Мајић
Џабер: bra...@majic.rs
Молим вас да додатке шаљете искључиво у слободним форматима.


signature.asc
Description: PGP signature


Feed uploaded file into process

2013-05-12 Thread Torsten Bronger
Hallöchen!

I want users to upload very large tar balls to my site.  I think it
is sensful to feed them to "tar -xzf" during the upload.  Is this
possible with Django?  I think the standard way with iterating over
chunks doesn't start before the whole file has been already stored
on disk, does it?  (I don't even need the original file.)

Tschö,
Torsten.

-- 
Torsten BrongerJabber ID: torsten.bron...@jabber.rwth-aachen.de
  or http://bronger-jmp.appspot.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Django and apache

2013-05-12 Thread Stanley Agba
Hello guys, 
please I'm kind of a noob at django and I'm trying to deploy a django site 
on Apache with mod_wsgi, I am not using a virtualenv as the server has 
python installed.
I added the following to my /etc/apache2/apache2.conf 


   ServerName example
   ServerAlias example
   ServerAdmin exam...@example.com

   DocumentRoot /var/www/example/static
   WSGIScriptAlias / /var/www/example/example/wsgi.py
   WSGIPythonPath  /var/www/example
   
   
  Order allow,deny
  Allow from all
   
   

   Alias /head.jpg  /var/www/example/static/head.jpg
   Alias /media/ /var/www/example/uploads
   Alias /static /var/www/example/static

   
   Order deny,allow
   Allow from all
   

  
  Order deny,allow
  Allow from all
  

  ErrorLog /var/www/python_ng/logs/error.log
  CustomLog /var/www/python_ng/logs/access.log combined


I got a 'WSGIPythonPath cannot be in virtual host section' error.
I have searched for previous topics but i have not been able to get a 
solution, I would greatly appreciate any help.
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Problems installing my first django app

2013-05-12 Thread lastripas records
I've followed the tutorial for building my first app on django.
I run all the comands via ssh to my remote server.

I make a directory on my server into 'public_html' default directory.
Then on this folder I run the comand django-admin.py startproject mysite

When I try to run the manage.py...it gives me some error '-jailshell: 
manage.py: command not found'

By the way the directory seems to have only the manage.py file...


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Yet Another NoReverseMatch Error

2013-05-12 Thread neil
I have an app within my project called popular_keywords. 

Within *urls.py* I have this:

*urlpatterns = patterns("apps.popular_keywords.views",*
*   url("^%keyword/(?P.*)%s$" % _slashes, 
"matching_items_list", **name="matching_items")*
*)*


Within *views.py* I have this function:

*def matching_items_list(request, keyword=None, 
template="popular_keywords/keyword_matched_list.html")*



In my template I have this:

**
*
*
*
*
The problem is when I view my page I find this:


*NoReverseMatch at /*

*Reverse for 'matching_items' with arguments '()' and keyword arguments 
'{u'keyword': 'Cake'}' not found.*

*
*

I thought I had my bases covered, but as a Django noob, I would appreciate help 
on whatever silly thing I missed. Please let me know if I need to provide more 
information.


Thanks.






-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: HttpResponse.has_header

2013-05-12 Thread Masklinn
On 12 mai 2013, at 05:04, Larry Martell  wrote:
> On Sat, May 11, 2013 at 9:08 AM, Masklinn  wrote:
>> 
>> On 2013-05-11, at 17:01 , Larry Martell wrote:
>> 
>>> On Sat, May 11, 2013 at 8:23 AM, Masklinn  wrote:
 On 2013-05-11, at 15:57 , Larry Martell wrote:
> 
> Yes, that is what I did. This is not in my urlconf. It's in a view
> function. I replaced:
> 
> return direct_to_template(request, template)
> 
> by:
> 
> return TemplateView.as_view(template_name=template)
> 
> Is that not correct?
 
 Indeed not, `TemplateView.as_view(template)` is roughly equivalent to
 `functools.partial(direct_to_template, template=template)`: it's only
 one half of the operation, which returns a callable replying to
 requests.
 
 You need something along the lines of 
 `TemplateView.as_view(template)(request)`
>>> 
>>> I appreciate all the assistance. I tried that and got:
>>> 
>>> TypeError: as_view() takes exactly 1 argument (2 given)
>> 
>> Oh yeah, you need to pass it as the keyword argument "template_name"
>> sorry about that. Basically take your code and add "(request)" at the
>> end.
>> 
>> If the current request is a GET obviously.
> 
> Thanks. That got me further along. I don't understand that syntax
> though. Never see that before.

It's nothing more than a function returning a function, both being called in 
sequence

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: problem with inserting data through sqlite manually.

2013-05-12 Thread Pradeep Kumar
Hi Anvesh,

I didn't understand how you were trying to insert into the tables. Probably
your sql code would have helped us hitting on the nail of the problem but
anyways let me give you general answers:

a) If id field is auto in the database one doesn't need to mention or enter
it explicitly while entering table data in the database. Thats how django
does or any other application does.
b) What is your query are you trying to send blank id to the database and
expecting it would take care of like

INSERT INTO XYZ (id, blah, blah ...) values ('', blah, blah ...) ?

Depending on what you have defined the ID field in the database( it should
be a primary key so obviously not null, blank=False) it won't accept the
above query.

Try inserting all the other fields in the table except id this way

INSERT INTO XYZ (blah, blah ...) values (' blah, blah ...)

ID will be automatically generated to the tables.


c) Try checking for other constraints in the table which you are inserting
into, are the fields NOT NULL, UNIQUE etc etc? Once you meet all the
constraints then only the data can be pushed to the table.


Please try to post the exact error and some code to get better idea for us
to reply.



Thanks,
Pradeep


On Fri, May 10, 2013 at 3:23 PM, Avnesh Shakya wrote:

> Hi,
>  I am inserting data into my models using sqlite3 manually, but it's
> not storing without id, it's generating error,  this Id is generated
> automatically in django. how is it possible that i can store data without
> taking id value. please help me out.
>
> thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.