Hi Nick,

views.py

class LaunchRockForm(ModelForm):
    class Meta:
        model = LaunchRock
        exclude = ['sign_date', 'ip', 'http_refer']

    def clean_email(self):
        try:
            LaunchRock.objects.get(email=self.cleaned_data['email'])
        except LaunchRock.DoesNotExist:
            return self.cleaned_data['email']
        raise forms.ValidationError(_("This is email is already in 
database."))


def signup(request):
    if request.method == 'POST':
        form = LaunchRockForm(data=request.POST)
        if form.is_valid():
            launch = 
LaunchRock.objects.create(email=form.cleaned_data['email'], 
sign_date=datetime.datetime.now(),
                                               
ip=request.META['REMOTE_ADDR'], http_refer=request.META['HTTP_REFERER'])
            return HttpResponseRedirect("/done/")
    else:
        form = LaunchRockForm()
    return render_to_response('launch.html', {'form': form}, 
context_instance=RequestContext(request))


def done(request):
    return render_to_response('done.html')


models.py

class LaunchRock(models.Model):
    email = models.EmailField()
    sign_date = models.DateTimeField(default=datetime.datetime.now)
    ip = models.IPAddressField()
    http_refer = models.TextField(blank=True, null=True)

    class Meta:
        db_table = 'launch'

    def __unicode__(self):
        return self.email


On Monday, March 10, 2014 2:01:13 AM UTC-3, Nick Santos wrote:
>
> Hey Henrique,
>
> Can you send the code for the view that generates the page?
>
> -Nick <javascript:>
>  
>
> On Sun, Mar 9, 2014 at 9:14 PM, Henrique Oliveira 
> <henrique...@gmail.com<javascript:>
> > wrote:
>
>> Hi there,
>>
>> I have set Django + gunicorn + python 3 in a production env, but I am 
>> gettin critical timeout on simple request(home).
>> Any Ideas?
>>
>> 14-03-09 23:11:21 [14029] [INFO] Listening at: http://127.0.0.1:8001(14029)
>> 2014-03-09 23:11:21 [14029] [INFO] Using worker: sync
>> 2014-03-09 23:11:21 [14039] [INFO] Booting worker with pid: 14039
>> 2014-03-09 23:11:21 [14040] [INFO] Booting worker with pid: 14040
>> 2014-03-09 23:11:21 [14041] [INFO] Booting worker with pid: 14041
>> 2014-03-09 23:11:31 [14040] [DEBUG] GET /done
>> 2014-03-09 23:12:02 [14029] [CRITICAL] WORKER TIMEOUT (pid:14040)
>> 2014-03-09 23:12:02 [14029] [CRITICAL] WORKER TIMEOUT (pid:14040)
>>
>> Cheers
>>  
>> -- 
>> 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 <javascript:>.
>> To post to this group, send email to django...@googlegroups.com<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/641f550d-4e8b-4a36-b76f-93d8100f3500%40googlegroups.com<https://groups.google.com/d/msgid/django-users/641f550d-4e8b-4a36-b76f-93d8100f3500%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/18659448-1537-4ed1-9db8-8b352beaaaec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to