Re: 'CharField' object has no attribute 'model'

2015-12-28 Thread Billu
Thanks, I had changed it to 

questions_included = models.ForeignKey('quiz.Question', null=True)

and also changed the db from Postgresql to Sqlite. Will see if this problem 
again comes up.

@luisza14 - did you find out by going through the code or are there any 
other ways to find 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c81161c4-8167-444d-b10a-20e3fceab550%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 'CharField' object has no attribute 'model'

2015-12-28 Thread Luis Zárate
I guest the problem is here
questions_included = models.ForeignKey(models.QuestionAnswer)

Django models haven't QuestionAnswer.


El sábado, 26 de diciembre de 2015, Simon Charette 
escribió:
> Hi Billlu,
> Does one your model use an ArrayField?
>
> Le samedi 26 décembre 2015 01:34:02 UTC-5, Billu a écrit :
>>
>> I'm trying to make a single choice quiz (i.e. Choose one from 4
options). I'll populate the quiz (with 30 questions) depending upon what
topic the user chooses. I'm made some models and forms, but when I try to
migrate it says
>>>
>>> AttributeError: 'CharField' object has no attribute 'model'
>>
>> I don't even know which model has problem. I've tried it in Django 1.9
(with virtualenv) & 1.8, same error. I've tried both manage.py check &
manage.py runserver and they all come up ok (with runserver saying I need
to migrate).
>> Python 2.7
>> Windows 7
>> Below are my models. Tell me if you require anything else. It's only
partially made and I've taken long-cuts in many things, 1st I've to make
the thing work.
>> from django.db import models
>> from django.template.defaultfilters import slugify
>> from django.conf import settings
>> from django.contrib.auth.models import User
>>
>>
>> class UserProfile(models.Model):
>>  user = models.OneToOneField(settings.AUTH_USER_MODEL)
>>  topic = models.CharField(max_length=50, blank=True)
>>
>>
>>  def __unicode__(self):
>>  return self.user.username
>>
>>
>> class Subject(models.Model):
>>  subject_name = models.CharField(max_length=50)
>>
>>
>>  def __unicode__(self):
>>  return self.subject_name
>>
>>
>> class QuestionAnswer(models.Model):
>>  subject = models.ManyToManyField(Subject)
>>  question_text = models.TextField(max_length=150)
>>  option_w = models.CharField(max_length=75, blank=True, null=True)
>>  option_x = models.CharField(max_length=75, blank=True, null=True)
>>  option_y = models.CharField(max_length=75, blank=True)
>>  option_z = models.CharField(max_length=75, blank=True)
>>  correct_answer = models.CharField(max_length=75, blank=False,
default=None)
>>  on = models.BooleanField(default=True)
>>
>>
>>  def __unicode__(self):
>>  return self.id
>>
>>
>>  class Meta:
>>  app_label = 'QuestionAnswer'
>>  verbose_name='Question'
>>  verbose_name_plural = 'Questions'
>>
>>
>> class QuizAttempt(models.Model):
>>  username = models.ManyToManyField(User)
>>  subject = models.ManyToManyField(Subject)
>>  slug = models.SlugField(unique=False)
>>  datetime = models.DateTimeField(auto_now_add=True)
>>  questions_included = models.ForeignKey(models.QuestionAnswer)
>>  correctly_answered_questions = models.IntegerField()
>>  total_marks = models.IntegerField()
>>
>>
>>  class Meta:
>>  verbose_name='Quiz'
>>  verbose_name_plural = 'Quizzes'
>>
>>
>>  def save(self, *args, **kwargs):
>>  self.slug = slugify(self.username +' ' +  self.subject + ' ' +
self.datetime.month +' ' +  self.datetime.year)
>>  super(QuizAttempt, self).save(*args, **kwargs)
>>
>>
>>  @property
>>  def correct_answer_count(self):
>> return self._correct_answer_count
>>
>>  def __unicode__(self):
>>  return "Quiz ID is {}".format(self.id)
>>  return "The quiz was taken by {} on {}".format(self.username,
self.topic)
>>  return "The quiz was taken on {}".format(self.datetime)
>>
>>
>>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/4fab10f3-8b29-4a1d-830a-26ff6ad6d0f5%40googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG%2B5VyNJNsj8X6WTpMqRy8D%3DYPQLGXLjG64oH2gvQvbQStvJrw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Migrate django project to eclipse/pydev ide

2015-12-28 Thread Luis Zárate
I use Aptana studio that is an eclipse fork and has pydev include also
django is well supported.

El miércoles, 23 de diciembre de 2015, Gary Roach 
escribió:
> To your first question, in one word $money. I would love to use PyCharm
but I am not a commercial developer and can't see paying the freight for
most of the commercial packages. I applied for a free version of PyCharm
and never heard back from them. The biggest complaint with Eclipse that I
have heard is the size of the package. I have a half terabyte of storage, a
four processor cpu and 4 gbytes of ram expandable to 16 gB. I don't care if
the package is functional. I'm not much of a purist in these matters.
>
> Your second question is harder. Every howto I looked at was different.
I'm sure that this is due to version changes. Bu still. So lets take the
one at
http://www.pydev.org/faq.html#PyDevFAQ-HowdoIimportexistingprojects/sourcesintoPyDev?
since I am importing existing Django projects into PyDev and the project
has never been in Eclipse we try option 1.
> File > New . PyDev File > New > PyDev Project wizard and select as the
directory the directory with your sources. So:
> File (OK) > New (No pydev project wizard show ) > Project > Select a
wizard (only Pydev shown) > dropdown PyDev .> PyDev Django Project and hit
next. And we get a whole page full of choices  that are not covered in the
tutorial. The next section talks about importing and setting the PyDev
Django Project and adding 2 string sub variables ((on right click project >
properties > PyDev PYTHONPATH) . Of course I'm still back there with this
window with all of the choices starting with Project Name (easy), Project
content (not sure), several selections that are pretty obvious and then 4
selections like Create 'src' folder and add to PYTHONPATH, Create link to
..., etc . By this time IV'E LOST IT. I can bumble along and come up with
something but have no idea weather it's correct. This could really bite me
later. Ever single howto that I have looked at has the same problem. I can
figure out things if the howto is close but when big chunks have been left
out? I've managed to get through Tango With Rango even using python 3.4 and
Django 1.8 with not too much trouble. But this!
>
> Like I said before, I can't afford to spend money on a commercial product
and hope someone can point me in the right direction with Eclipse / PyDev.
>
> Any help will be sincerely appreciated
>
> Gary R.
>
>
> On 12/22/2015 04:05 PM, Andrew Farrell wrote:
>
> Could you also tell us:
> 1) Why you need to switch to Eclipse specifically rather than
PyCharm, SublimeText, or (the one I use) Atom?
> 2) What error Eclipse is showing or what functionality is not working?
> On Tue, Dec 22, 2015 at 5:32 PM, Gary Roach 
wrote:
>>
>> Hi all;
>>
>> I have been working on a project for some time using Ninja-IDE.
Unfortunately the development on Ninja has - for all practical purposes -
stopped. It no longer works for me. I need to switch to Eclipse with the
Pydev plugin and am having trouble finding out how to do this. I have
looked at several howto's. So far I can follow them up to a point and then
what shows up on the screen starts to depart from what's in the howto. The
end result is that I can't finish the process. Also there is no mention of
virtual environments. This worries me. I have multiple projects on my
system.
>>
>> I'm using:
>> Debian stretch Linux
>> Eclipse 3.8
>> pyDev 4.4.0
>> django 1.8,4
>> python 3.4
>> venv (not virtualenv) virtual environment
>> git with github repository
>> postgresql 9.4 dbms
>>
>> Can someone point me in the right direction with this.
>>
>> Gary R.
>>
>> --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/5679DD71.708%40verizon.net.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CA%2By5TLb_ogeU-aV2OLfOENxJGxG0WkUdX0H_0eh--9kmARnb6Q%40mail.gmail.com
.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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-user

Django how select one photo per gallery in one call to DB?

2015-12-28 Thread piasek piasek
I have two models: 
Gallery and Photo, Photo has Gallery as FK.

Is it possible to return in one call one photo per gallery?

I already tried:
photos = Photo.objects.filter(active=True)
photos.annotate(g=Count('gallery'))
unfortunately when I call query I got something like that:

GROUP BY "wall_photo"."id", "wall_photo"."added_date", 
"wall_photo"."title", "wall_photo"."active", "wall_photo"."gallery_id", 
"wall_photo"."description"

which return me the same as above photos query without annotate :(

I tried also transform photos to SQL query and add group_by

query_photo = photos.query
query_photo.group_by = ['gallery']

Photo.objects.raw(query_photo.__str__())
and again I got the same result.

Do you know a way to do it in one call?

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/07166b8b-c56b-4ef2-a2ce-c0f1266fd95a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Display form errors above its respective field with ajax

2015-12-28 Thread Abhishek Bansal


On Monday, December 28, 2015 at 11:11:13 AM UTC+5:30, Robin Lery wrote:
>
> I have a contact form through which users would be able to contact me. I 
> am using django with ajax, and it works fine if there's no error. I would 
> like to show the errors if there's any like it displays above the input 
> fields and not just the errors, but both the input and the errors. It does 
> however differentiate between the success and error result, as the ajax 
> request was successful. But I need to display the actual form errors. 
>
> I would like to display the errors like the below as it normally does 
> without ajax:
>
>
> ​
>
> How do I that? Your help will be very much appreciated. Thank you.
>
> views:
>
> def contact(request):
> if request.is_ajax() and request.POST:
> form = ContactForm(request.POST)
> if form.is_valid():
> new_contact = form.save()
> data = {
> 'result': 'success',
> 'message': 'Message Sent.'
> }
> return JsonResponse(data)
> else:
> data = {
> 'result': 'error',
> 'message': 'Form invalid',
> 'form': 'oops.'
> }
> return JsonResponse(data)
> else:
> form = ContactForm()
> return render(request, 'public_contact.html', {
> 'form': form
> })
>
> js:
>
> contact_right_form.find('#submit').on('click', function(event) {
> event.preventDefault();
> $.ajax({
> type: contact_right_form.attr('method'),
> url: '/contact/',
> data: contact_right_form.serialize(),
> dataType: 'json',
> success: function(data) {
> if ( data.result == 'success') {
> contact_right_message_sent.text(data.message);
> contact_right_message_sent.show();
> }
> else {
> contact_right_message_sent.text(data.message);
> contact_right_message_sent.show();
> }
> },
> error: function() {
> contact_right_message_sent.text('Sorry! Something went 
> wrong.')
> }
> });
> })
>


Can u please clarify what do you want to accomplish?? 

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/59c41277-3b9d-4390-b4f6-ef6fdfbfb8fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Aw: React.js with django-rest-framework using SessionAuthentication: How to include CSRF-Token documentation has not helped me :/

2015-12-28 Thread lnzy35en

Solution was to use: csrfmiddlewaretoken insteed of csrftoken.

I hope that will save someones days, that run into the same issues.

 

 

Gesendet: Sonntag, 27. Dezember 2015 um 13:29 Uhr
Von: lnzy3...@gmx.de
An: django-users@googlegroups.com
Betreff: React.js with django-rest-framework using SessionAuthentication: How to include CSRF-Token documentation has not helped me :/



 

 


 
--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/trinity-89d49cc4-75fa-4819-b907-b52935f8e3c7-1451219372016%403capp-gmx-bs17.
For more options, visit https://groups.google.com/d/optout.






-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/trinity-c185d9ba-0904-4750-8445-b805c037e2de-1451319368980%403capp-gmx-bs68.
For more options, visit https://groups.google.com/d/optout.


Re: Scanning for Wifi

2015-12-28 Thread Bill Freeman
Yes, though there probably isn't a slick app for the PC to do it.

You would have a web server running on the Pi, maybe Django, that displays
the available wireless networks.  You would want a button to re-scan.  This
works by trigering a shell command to run iwlist (or whatever the current
tool is), which would dump the results of the last scan in a file that the
web-server reads when composing the page (probably a RAM disk file on the
Pi, rather than consuming Flash write cycles).  The page would have
JavaScript to reload occasionally (or, of course, on demand) or use AJAX so
that you can see things picked up recently.  Clicking one of the listed
items (you would probably also want a text field to enter SSID for hidden
interfaces) would open a text field that lets you enter WPA or WEP key, for
SSIDs that are secured.  (Probably this is just JavaScript unhiding it - no
need to go to a new page.)  When you submit, Django spawns iwconfig or
equivalent to connect the interface.  You probably also want a disconnect
button, and maybe a reconnect button (using saved key so that you don't
have to re-enter it - you could get fancy by remembering keys for SSIDs
that you've connected to before).

It's probably safe enough to let anyone see the list, but the connect,
disconnect, any reconnect, and maybe even the rescan buttons should require
that you have logged in to Django with a password.  The default
configuration should be to only be accessible from the wired interface,
though I guess there is some value in being able to disconnect from the
WiFi connection.

Of course, Pis come with wired ethernet, but I believe that even the B+
still doesn't come with WiFi, so you will need a USB WiFi dongle.

On Mon, Dec 28, 2015 at 8:26 AM, Andrew Stringfield 
wrote:

> Hello all,
>
>I saw a really cool feature that D-link wireless cameras have.
> First you physically hook up the camera to the LAN and then access the
> camera via web interface.  While on the web interface you can scan for your
> wireless network and connect the camera, wirelessly, to your network.  That
> is what I would like to do with my Django project.  Is this possible?
>
> The host OS is Raspbian on Raspberry Pi B+.
>
> Thank you.
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f74a348d-8f4d-4f98-8bea-33fe74c1c706%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB%2BAj0tnhNMhDTVumm9eE3VKo5Oa2jk%3DnQiD-SwNBhtj8XaR7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Scanning for Wifi

2015-12-28 Thread Andrew Stringfield
Hello all,

   I saw a really cool feature that D-link wireless cameras have. First 
you physically hook up the camera to the LAN and then access the camera via 
web interface.  While on the web interface you can scan for your wireless 
network and connect the camera, wirelessly, to your network.  That is what 
I would like to do with my Django project.  Is this possible?

The host OS is Raspbian on Raspberry Pi B+.

Thank you.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f74a348d-8f4d-4f98-8bea-33fe74c1c706%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: settings.py variables in fixtures

2015-12-28 Thread Salvatore Scaramuzzino
Thank you Russel, 

you centered my problem, I asked here in case exists a solution for this 
that i doesn't know.

I will write my own management script that "adapt" the dump data contained 
in JSON to the particular "installation" of the web application.

thanks again for your support.



Il giorno lunedì 28 dicembre 2015 01:19:05 UTC+1, Russell Keith-Magee ha 
scritto:
>
> Hi Salvatore,
>
> On Mon, Dec 28, 2015 at 12:09 AM, Salvatore Scaramuzzino <
> salvatores...@gmail.com > wrote:
>
>> hi to everyone
>>
>> i'm newbye in django, but i really appreciate this useful framework. I 
>> have a simple question but i don't know if is appropriate.
>>
>> i have a fixture written in JSON and i use it to provide initial data to 
>> my webapp. i want to provide in this fixture absolute paths in order to 
>> store some images. is there a way to use in JSON fixtures (or in 
>> another format) variables defined in settings.py (eg. base path of the app)?
>>
>  
> To make sure I’ve understood your use case: you want to have a JSON (or 
> similar format) file that contains absolute paths to some images, and load 
> these images into your database, relative to some setting in your 
> settings.py file.
>
> If that’s the case, you probably won’t be able to use Django’s default 
> serializer framework - Django’s serialisers are designed to be little more 
> than a dump (and restore) of literal database content. Transforming input 
> along the way isn’t something they are designed to do. You *might* be able 
> to do something by writing a custom field and manipulating the 
> deserialisation code on the field, but honestly, it’s going to be more 
> trouble than it’s worth.
>
> What you are trying to do is still completely achievable, though - you 
> just have to write your own management command. That command will take the 
> name of the JSON file as an argument, parse it and iterate through the 
> content, and process the absolute paths into whatever local storage path 
> you want to use. 
>
> I hope that makes sense; if it doesn’t (or I’ve misunderstood your use 
> case) let me know and I’ll elaborate some more.
>
> Yours,
> Russ Magee %-)
>
>
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fe7d27d4-da96-4c95-987e-997ea2f0395d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


pip install twisted hangs

2015-12-28 Thread Ganeshwari Sk
I have my standalone box without internet connection and having pythong 
packages in a directory to install,

I used the following pip command to install the python package with the 
"requirement" file

/usr/bin/pip install --no-download -r ./installer/requirements -b 
./installer/SOURCES/python-modules-sources 
--install-option=--prefix=/somedirectory/tmp

and the requirement file looks like this,


django==1.6.8
django-evolution==0.7.4
django-pipeline==1.3.25
django-haystack==2.3.1
argparse==1.3.0
markdown==2.4.1
mimeparse==0.1.3
recaptcha-client==1.0.6
SOAPpy==0.12.5
PyXB
python-dateutil==1.5
python-memcached==1.53
paramiko==1.15.1
Pygments==1.6
pytz==2014.7 
feedparser==5.1.3
ecdsa==0.11
jsmin==2.0.6
docutils==0.12
fpconst==0.7.2
futures==2.2.0
pillowfight==0.2
Whoosh==2.6.0
wstools==0.3
twisted==13.2.0
backports.ssl-match-hostname==3.5.0.1
tornado==3.2
zope.interface==4.0.5
pycrypto==2.6.1



when executing  Running setup.py install for twisted
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall 
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
--param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv 
-DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic 
-D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.6 -c conftest.c -o 
conftest.o
building 'twisted.runner.portmap' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall 
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
--param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv 
-DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic 
-D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.6 -c 
twisted/runner/portmap.c -o 
build/temp.linux-x86_64-2.6/twisted/runner/portmap.o
gcc -pthread -shared 
build/temp.linux-x86_64-2.6/twisted/runner/portmap.o -L/usr/lib64 
-lpython2.6 -o build/lib.linux-x86_64-2.6/twisted/runner/portmap.so


It is hanging with the above line and after 15 to 20 mins, If I issue 
ctrl+c, it is not showing any error, and in /root/.pip/pip.log, I could see 
only the following at end,

 building 'twisted.runner.portmap' extension

gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall 
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
--param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv 
-DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic 
-D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.6 -c 
twisted/runner/portmap.c -o 
build/temp.linux-x86_64-2.6/twisted/runner/portmap.o

gcc -pthread -shared 
build/temp.linux-x86_64-2.6/twisted/runner/portmap.o -L/usr/lib64 
-lpython2.6 -o build/lib.linux-x86_64-2.6/twisted/runner/portmap.so

Operation cancelled by user

Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pip/basecommand.py", line 104, in 
main
status = self.run(options, args)
  File "/usr/lib/python2.6/site-packages/pip/commands/install.py", line 
250, in run
requirement_set.install(install_options, global_options)
  File "/usr/lib/python2.6/site-packages/pip/req.py", line 1133, in install
requirement.install(install_options, global_options)
  File "/usr/lib/python2.6/site-packages/pip/req.py", line 577, in install
cwd=self.source_dir, filter_stdout=self._filter_install, 
show_stdout=False)
  File "/usr/lib/python2.6/site-packages/pip/__init__.py", line 230, in 
call_subprocess
line = console_to_str(stdout.readline())
KeyboardInterrupt


pip --version
pip 1.1 from /usr/lib/python2.6/site-packages (python 2.6)
python --version
Python 2.6.6


Would anyone please tell me where it is going wrong and what package is 
missing ?

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/13a28a4b-12f0-47e1-bd41-7d3f8c82b72b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Running setup.py install for twisted hangs

2015-12-28 Thread Ganeshwari Sk
I have standalone box with python packages downloaded and no internet 
connection. And when I tried to execute 

/usr/bin/pip install --no-download -r ./installer/requirements -b 
./installer/SOURCES/python-modules-sources 
--install-option=--prefix=/somepath/tmp

It is hanging when "Running setup.py install for twisted"

gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall 
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
--param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv 
-DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic 
-D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.6 -c conftest.c -o 
conftest.o
building 'twisted.runner.portmap' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall 
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
--param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv 
-DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic 
-D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.6 -c 
twisted/runner/portmap.c -o 
build/temp.linux-x86_64-2.6/twisted/runner/portmap.o
gcc -pthread -shared 
build/temp.linux-x86_64-2.6/twisted/runner/portmap.o -L/usr/lib64 
-lpython2.6 -o build/lib.linux-x86_64-2.6/twisted/runner/portmap.so


This is how my "requriements" file looks,
django==1.6.8
django-evolution==0.7.4
django-pipeline==1.3.25
django-haystack==2.3.1
argparse==1.3.0
markdown==2.4.1
mimeparse==0.1.3
recaptcha-client==1.0.6
SOAPpy==0.12.5
PyXB
python-dateutil==1.5
python-memcached==1.53
paramiko==1.15.1
Pygments==1.6 
pytz==2014.7
feedparser==5.1.3
ecdsa==0.11
jsmin==2.0.6
docutils==0.12
fpconst==0.7.2
futures==2.2.0
pillowfight==0.2
Whoosh==2.6.0
wstools==0.3
twisted==13.2.0
backports.ssl-match-hostname==3.5.0.1
tornado==3.2
zope.interface==4.0.5
pycrypto==2.6.1


 pip --version
pip 1.1 from /usr/lib/python2.6/site-packages (python 2.6)

python --version
Python 2.6.6


If I issue ctrl+C after 15 to 20 mins, I could not see any error message.
I see only the following in /root/.pip/pip.log,

 gcc -pthread -shared build/temp.linux-x86_64-2.6/twisted/runner/portmap.o 
-L/usr/lib64 -lpython2.6 -o 
build/lib.linux-x86_64-2.6/twisted/runner/portmap.so

Operation cancelled by user

Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pip/basecommand.py", line 104, in 
main
status = self.run(options, args)
  File "/usr/lib/python2.6/site-packages/pip/commands/install.py", line 
250, in run
requirement_set.install(install_options, global_options)
  File "/usr/lib/python2.6/site-packages/pip/req.py", line 1133, in install
requirement.install(install_options, global_options)
  File "/usr/lib/python2.6/site-packages/pip/req.py", line 577, in install
cwd=self.source_dir, filter_stdout=self._filter_install, 
show_stdout=False)
  File "/usr/lib/python2.6/site-packages/pip/__init__.py", line 230, in 
call_subprocess
line = console_to_str(stdout.readline())
KeyboardInterrupt


Would anyone please help me to fix this issue ? Where it is going wrong and 
what is missing ?

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3f93474b-4647-4bb8-8787-47104b17517f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django debug= false throwing 503 error

2015-12-28 Thread Web Architect
Hi,

Thanks for your response.

I had run the server using runserver and it threw the same error:

December 28, 2015 - 08:57:30

Django version 1.8.4, using settings 'jivaana.settings'

Starting development server at http://0.0.0.0:8600/

Quit the server with CONTROL-C.

HTTPError = 503

*[28/Dec/2015 08:57:31] "GET /catalogue/ HTTP/1.1" 500 2990*

HTTPError = 503

*[28/Dec/2015 08:57:37] "GET /accounts/login/ HTTP/1.1" 500 2990*

HTTPError = 503

*[28/Dec/2015 09:01:55] "GET /catalogue/ HTTP/1.1" 500 2990*


*I am sorry I should have mentioned. After all the above debugging, I was 
clueless what was going wrong.*


The DEBUG and ALLOWED_HOSTS was set as per documentation. Not sure if 
anything more was needed.


Thanks.

On Monday, December 28, 2015 at 3:40:24 PM UTC+5:30, esauro wrote:
>
> Hi,
> I assume the development server is working. If that is the case it could 
> be that you have a problem with your production stack. I remember a 
> situation long time ago (like Django 1.1 or so) a project I run with apache 
> + mod_wsgi and we have a problem like this (I don't remember the error 
> code) because there were a "print" in the code.
>
> So please confirm you can use "runserver"
> * If so, try to put more data on your production stack (web server, 
> wsgi gateway, etc.)
> * If no you'll probably have much more data to fix the problem.
>
> Regards,
> Esau.
>
>
>
> On Mon, Dec 28, 2015 at 8:46 AM, Web Architect  > wrote:
>
>> Hi,
>>
>> I have set the following in settings.py for our production system:
>>
>> DEBUG=False
>>
>> ALLOWED_HOSTS = ['*'] (in fact any value is not working)
>>
>> The server is throwing "HTTPError = 503". 
>>
>> There are no logs and I am clueless about the reason for the error. I 
>> tried searching the net and looking into DJango documents but couldn't find 
>> the possible reason.
>>
>> Django version is 1.8.3. 
>>
>> Would really appreciate if anyone could help with the above.
>>
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/a3a76d7c-438c-442d-a68b-3d31859b4708%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Esaú Rodríguez
> esa...@gmail.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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/284d41eb-fbba-469c-b9e0-148b65daf38c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django debug= false throwing 503 error

2015-12-28 Thread Web Architect
I had run the server locally using ./manage.py runserver and it threw the 
error on the console:

December 28, 2015 - 08:57:30

Django version 1.8.4, using settings 'jivaana.settings'

Starting development server at http://0.0.0.0:8600/

Quit the server with CONTROL-C.

HTTPError = 503

*[28/Dec/2015 08:57:31] "GET /catalogue/ HTTP/1.1" 500 2990*

HTTPError = 503

*[28/Dec/2015 08:57:37] "GET /accounts/login/ HTTP/1.1" 500 2990*

HTTPError = 503

*[28/Dec/2015 09:01:55] "GET /catalogue/ HTTP/1.1" 500 2990*


*I do not have any other logs which I could share. If any more info is 
needed, I could try to gather.*


*Thanks.*

On Monday, December 28, 2015 at 3:08:01 PM UTC+5:30, monoBOT monoBOT wrote:
>
> ​Your server is not working, the first thing to do always is see what is 
> the error message:
>
> 503 Service Unavailable
>
> The server is currently unable to handle the request due to a temporary 
> overloading or maintenance of the server. The implication is that this is a 
> temporary condition which will be alleviated after some delay. If known, 
> the length of the delay MAY be indicated in a Retry-After header. If no 
> Retry-After is given, the client SHOULD handle the response as it would for 
> a 500 response.
>
> Note: The existence of the 503 status code does not imply that a server 
> must use it when becoming overloaded. Some servers may wish to simply 
> refuse the connection.
>
> When you face similar things you should test them locally (with manage.py 
> runserver) with the exact same configuration for django to show you the 
> error message.​ 
> You have not explained too much so we can not help you more.
>
>
> 2015-12-28 8:46 GMT+00:00 Web Architect >:
>
>> Hi,
>>
>> I have set the following in settings.py for our production system:
>>
>> DEBUG=False
>>
>> ALLOWED_HOSTS = ['*'] (in fact any value is not working)
>>
>> The server is throwing "HTTPError = 503". 
>>
>> There are no logs and I am clueless about the reason for the error. I 
>> tried searching the net and looking into DJango documents but couldn't find 
>> the possible reason.
>>
>> Django version is 1.8.3. 
>>
>> Would really appreciate if anyone could help with the above.
>>
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/a3a76d7c-438c-442d-a68b-3d31859b4708%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> *monoBOT*
> Visite mi sitio(Visit my site): monobotsoft.es/blog/
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/060a429d-06a1-4232-a316-b2fcfaea922f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django debug= false throwing 503 error

2015-12-28 Thread Web Architect
Thanks for your message.

On Production, I am running the server behind Nginx. Its run using uwsgi. 
The server works fine with "DEBUG=True" but when it's set to false, it 
throws http 503 error. I saw it in uwsgi logs. Also, when I ran the server 
locally with ./manage.py runserver, its on the console.

Thanks.

On Monday, December 28, 2015 at 3:01:39 PM UTC+5:30, aRkadeFR wrote:
>
> Hello,
>
> How do you run your server in production?
> Where do you see the server throwing the 503 error?
>
> Thanks,
>
> On 12/28/2015 09:46 AM, Web Architect wrote:
>
> Hi, 
>
> I have set the following in settings.py for our production system:
>
> DEBUG=False
>
> ALLOWED_HOSTS = ['*'] (in fact any value is not working)
>
> The server is throwing "HTTPError = 503". 
>
> There are no logs and I am clueless about the reason for the error. I 
> tried searching the net and looking into DJango documents but couldn't find 
> the possible reason.
>
> Django version is 1.8.3. 
>
> Would really appreciate if anyone could help with the above.
>
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> 
> https://groups.google.com/d/msgid/django-users/a3a76d7c-438c-442d-a68b-3d31859b4708%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> -- 
> aRkadeFR
>
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ccd569ad-e8a4-4670-a0b9-47d494f5847e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django debug= false throwing 503 error

2015-12-28 Thread Esau Rodriguez
Hi,
I assume the development server is working. If that is the case it could be
that you have a problem with your production stack. I remember a situation
long time ago (like Django 1.1 or so) a project I run with apache +
mod_wsgi and we have a problem like this (I don't remember the error code)
because there were a "print" in the code.

So please confirm you can use "runserver"
* If so, try to put more data on your production stack (web server,
wsgi gateway, etc.)
* If no you'll probably have much more data to fix the problem.

Regards,
Esau.



On Mon, Dec 28, 2015 at 8:46 AM, Web Architect  wrote:

> Hi,
>
> I have set the following in settings.py for our production system:
>
> DEBUG=False
>
> ALLOWED_HOSTS = ['*'] (in fact any value is not working)
>
> The server is throwing "HTTPError = 503".
>
> There are no logs and I am clueless about the reason for the error. I
> tried searching the net and looking into DJango documents but couldn't find
> the possible reason.
>
> Django version is 1.8.3.
>
> Would really appreciate if anyone could help with the above.
>
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a3a76d7c-438c-442d-a68b-3d31859b4708%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Esaú Rodríguez
esa...@gmail.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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB4Jw77oU1kmem6vbo-y0HJoCqvmx%3DZjnimxtX9x2tSLPyhijA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django debug= false throwing 503 error

2015-12-28 Thread monoBOT
​Your server is not working, the first thing to do always is see what is
the error message:

503 Service Unavailable

The server is currently unable to handle the request due to a temporary
overloading or maintenance of the server. The implication is that this is a
temporary condition which will be alleviated after some delay. If known,
the length of the delay MAY be indicated in a Retry-After header. If no
Retry-After is given, the client SHOULD handle the response as it would for
a 500 response.

Note: The existence of the 503 status code does not imply that a server
must use it when becoming overloaded. Some servers may wish to simply
refuse the connection.

When you face similar things you should test them locally (with manage.py
runserver) with the exact same configuration for django to show you the
error message.​
You have not explained too much so we can not help you more.


2015-12-28 8:46 GMT+00:00 Web Architect :

> Hi,
>
> I have set the following in settings.py for our production system:
>
> DEBUG=False
>
> ALLOWED_HOSTS = ['*'] (in fact any value is not working)
>
> The server is throwing "HTTPError = 503".
>
> There are no logs and I am clueless about the reason for the error. I
> tried searching the net and looking into DJango documents but couldn't find
> the possible reason.
>
> Django version is 1.8.3.
>
> Would really appreciate if anyone could help with the above.
>
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a3a76d7c-438c-442d-a68b-3d31859b4708%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*monoBOT*
Visite mi sitio(Visit my site): monobotsoft.es/blog/

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BxOsGAA%3DgESnoEOWT1XstS2nZUOyJ5eCRHWt8NmzzkMdB89zA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django debug= false throwing 503 error

2015-12-28 Thread aRkadeFR

Hello,

How do you run your server in production?
Where do you see the server throwing the 503 error?

Thanks,

On 12/28/2015 09:46 AM, Web Architect wrote:

Hi,

I have set the following in settings.py for our production system:

DEBUG=False

ALLOWED_HOSTS = ['*'] (in fact any value is not working)

The server is throwing "HTTPError = 503".

There are no logs and I am clueless about the reason for the error. I 
tried searching the net and looking into DJango documents but couldn't 
find the possible reason.


Django version is 1.8.3.

Would really appreciate if anyone could help with the above.

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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a3a76d7c-438c-442d-a68b-3d31859b4708%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
aRkadeFR

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5681010B.9060600%40arkade.info.
For more options, visit https://groups.google.com/d/optout.


How do I print the selected checkboxes names in django

2015-12-28 Thread santosh reddy
Hi All,

Please find the reuirement:

1) Need to retrieve the test cases from database
2) provide an option to user to selcect the test cases which he want to run.
3) Need to send the selected test cases to target.

forms.py
class CustomCheckboxSelectMultiple(forms.CheckboxSelectMultiple):
def __init__(self, attrs=None):
super(CustomCheckboxSelectMultiple, self).__init__(attrs)

def render(self, name, value, attrs=None, choices=()):
output = super(CustomCheckboxSelectMultiple, self).render(name, 
value, attrs, choices)

style = self.attrs.get('style', None)
if style:
output = output.replace("https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e1db87de-a02b-48b5-a056-cfd47497d347%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django debug= false throwing 503 error

2015-12-28 Thread Web Architect
Hi,

I have set the following in settings.py for our production system:

DEBUG=False

ALLOWED_HOSTS = ['*'] (in fact any value is not working)

The server is throwing "HTTPError = 503". 

There are no logs and I am clueless about the reason for the error. I tried 
searching the net and looking into DJango documents but couldn't find the 
possible reason.

Django version is 1.8.3. 

Would really appreciate if anyone could help with the above.

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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a3a76d7c-438c-442d-a68b-3d31859b4708%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.