Re: How to run background application via Django

2015-01-08 Thread Sugita Shinsuke
Hi Vijay Khemlani I tried tutorial. and "error: timed out" was disappeared! http://celery.readthedocs.org/en/latest/django/first-steps-with-django.html was deprecated. http://docs.celeryproject.org/en/master/django/first-steps-with-django.html is new. I added the code in my app/__init__.py:

Re: CSRF verification failed when I use smart phone

2015-01-08 Thread Zach Borboa
Mobile device could also be caching an incorrect csrf token. -- 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

Re: updating data in a row

2015-01-08 Thread James Schneider
What URL are you visiting and can you post the traceback? On Jan 8, 2015 9:25 PM, "sum abiut" wrote: > Hi, > I have change the URL mapping to url(r'^update_form/(?P\d+) > /$', 'eLeave.views.update_form'), > > but i am getting the error > > Page not found (404) > > any advise

Re: updating data in a row

2015-01-08 Thread sum abiut
Hi, I have change the URL mapping to url(r'^update_form/(?P\d+) /$', 'eLeave.views.update_form'), but i am getting the error Page not found (404) any advise i am getting this error? cheers On Fri, Jan 9, 2015 at 3:20 PM, Vijay Khemlani wrote: > You have two choices > >

Return to the requested page after successfull @login_required by the next variable

2015-01-08 Thread Robin Lery
Suppose this is the url after `@login_required(login_url='/accounts/required_login/')`: http://ngoksy.com/accounts/login_required/?next=/article/ view for the login_require: *def required_login(request):return render(request, 'required_login.html')* I tried adding 'next', like it

Re: How to run background application via Django

2015-01-08 Thread Sugita Shinsuke
Hi Vijay Khemlani Thank you for replying. >Have you done the celery tutorial? I have not done the celery tutorial yet. But, I ran Redis and set below in my settings.py BROKER_URL = 'redis://localhost' CELERY_RESULT_BACKEND = 'redis' CELERY_TASK_SERIALIZER = 'json' CELERY_RESULT_SERIALIZER =

Re: How to run background application via Django

2015-01-08 Thread Vijay Khemlani
Have you done the celery tutorial? Async tasks require you to have a broker (rabbitmq or something) and also to create some workers that actually execute the task. On Fri, Jan 9, 2015 at 12:55 AM, Sugita Shinsuke wrote: > Hi somecallitblues > > Thank you for replying. > I

Re: Pulling data from two table

2015-01-08 Thread sum abiut
Hi Vijay, Thanks very much for your assistance and recommendation. i will get back to you if needed more help. Sum On Fri, Jan 9, 2015 at 3:15 PM, Vijay Khemlani wrote: > Well, you can do something like this > > one_leave = leave.objects.get(pk=1) # Asuming there is a

Re: updating data in a row

2015-01-08 Thread Vijay Khemlani
You have two choices 1. Change the URL mapping and pass the "id" in the url url(r'^update_form/(?P\d+)/$', 'eLeave.views.update_form'), (then the url is something like /update_form/15/) 2, Change the view so that it only accepts the "request" argument def update_form(request): in that case

Re: Pulling data from two table

2015-01-08 Thread Vijay Khemlani
Well, you can do something like this one_leave = leave.objects.get(pk=1) # Asuming there is a leave with pk 1 print one_leave.staff.First_Name# Automatically joins with the staff table to print the first name of the associated staff Or something like this one_staff = staff.objects.get(pk=1)

Re: How to run background application via Django

2015-01-08 Thread Sugita Shinsuke
Hi somecallitblues Thank you for replying. I installed Celery 3.1.17. And, I setup I created add method in tasks.py my tasks.py from __future__ import absolute_import from celery import shared_task @shared_task def add(x, y): return x + y I also called my add method from my

Re: updating data in a row

2015-01-08 Thread sum abiut
hi James, here is the url.py url(r'^update_form/$', 'eLeave.views.update_form'), On Fri, Jan 9, 2015 at 2:19 PM, James Schneider wrote: > Looks like you aren't sending enough arguments to your view from the URL > dispatcher. What does your urls.py look like? > >

Re: updating data in a row

2015-01-08 Thread James Schneider
Looks like you aren't sending enough arguments to your view from the URL dispatcher. What does your urls.py look like? -James On Jan 8, 2015 6:49 PM, "sum abiut" wrote: > > Hi, > i am trying to update data in a row from an existing database but i keep > getting this error. >

updating data in a row

2015-01-08 Thread sum abiut
Hi, i am trying to update data in a row from an existing database but i keep getting this error. update_form() takes exactly 2 arguments (1 given) can someone advise what i am missing here. here are my code: view.py def update_form(request, id): if request.method == 'POST':

Re: Pulling data from two table

2015-01-08 Thread sum abiut
Hi, i am trying to pull out all the information in both model. i can pull out information in each table but i am a but confuse in joining the two tables together. something like NATURAL JOIN in mysql. Cheers, On Fri, Jan 9, 2015 at 12:07 PM, Vijay Khemlani wrote: > OK,

Re: Pulling data from two table

2015-01-08 Thread Vijay Khemlani
OK, what query are you trying to make? or what information do you want to display? On Thu, Jan 8, 2015 at 6:50 PM, sum abiut wrote: > Hi Vijay, > Thank you for your email. Here is my models. i want to be able to pull out > all the data from both table and display them. i am a

Re: running template system standalone on django 1.7.1 results in AppRegistryNotReady error

2015-01-08 Thread Oliver Willekens
Found it. That template had {% load staticfiles %} in it, which cannot be used in this standalone context. Op donderdag 8 januari 2015 02:32:00 UTC+1 schreef Oliver Willekens: > > I'm running into a problem when I'm trying to use Django's template system > in a standalone application.

Re: Unable to install django on ubuntu 12.04

2015-01-08 Thread sum abiut
Its permission issue. you need to login as root and then try install again. enjoy, Sum On Fri, Jan 9, 2015 at 8:21 AM, Alex Mandel wrote: > On 01/08/2015 12:06 PM, nitin katyal wrote: > > As per the Django installation guide, I have installed pip using "sudo > >

Re: Pulling data from two table

2015-01-08 Thread sum abiut
Hi Vijay, Thank you for your email. Here is my models. i want to be able to pull out all the data from both table and display them. i am a bit new to django still finding my way out. class staff(models.Model): First_Name = models.CharField(max_length=45) Last_Name

Re: Pulling data from two table

2015-01-08 Thread Vijay Khemlani
Please be more specific in your question, how are these tables related? what models are they associated with? On Thu, Jan 8, 2015 at 6:01 PM, sum abiut wrote: > Hi, > can someone please help. i am trying to pull data from two table in django > and display the results. can

Re: Unable to install django on ubuntu 12.04

2015-01-08 Thread Alex Mandel
On 01/08/2015 12:06 PM, nitin katyal wrote: > As per the Django installation guide, I have installed pip using "sudo > apt-get install python-pip". Pip got installed and upgraded successfully, > but when I was installing Django using "pip install django==1.7", the > following error appeared: >

Pulling data from two table

2015-01-08 Thread sum abiut
Hi, can someone please help. i am trying to pull data from two table in django and display the results. can someone please point me to the right direction. kind regards, Sum A -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

Re: what's different between {% static %} and {{ STATIC_URL}}

2015-01-08 Thread Florian Schweikert
On 2015-01-06 12:55, Andreas Kuhne wrote: The difference is the age of the django project you are looking at. {% load staticfiles %} the {% static %} is the current way to load and use static files. It also has the option to do other things (like MD5 hashes for versions) automatically and should

Unable to install django on ubuntu 12.04

2015-01-08 Thread nitin katyal
As per the Django installation guide, I have installed pip using "sudo apt-get install python-pip". Pip got installed and upgraded successfully, but when I was installing Django using "pip install django==1.7", the following error appeared: "error: could not create

Re: Model to create forms

2015-01-08 Thread Lorenzo Bernardi
Hello, this is what _relational_ databases are built for. if you have two tables, one for the description of the experiment (one record per experiment), and another for the statistics (one record per data sample, with a foreign key to the experiment record); then fetching the description of

Re: Model to create forms

2015-01-08 Thread Lorenzo Bernardi
Hello, 1) there is no other approach (like creating a model on the fly, that is not writing in models.py. But it looks against the way django works) and any idea is welcomed. Generally I've found that creating a real model to store the data is easiest in the long run and usually involves

Re: porting to 1.7

2015-01-08 Thread Collin Anderson
Hi, In your INSTALLED_APPS, be sure you have 'jadeempire.smartpages' instead of 'smartpages'. Also, any time you refer to a view, or any other import, be sure to always use the "jadeempire" prefix. Collin On Wednesday, January 7, 2015 at 8:48:20 AM UTC-5, MikeKJ wrote: > > I have hit a snag

Re: Filter_horizontal, applying filter on the right box - chosen items

2015-01-08 Thread ebuild
This doesn't answer the question. On Thursday, January 8, 2015 6:50:22 PM UTC+1, Collin Anderson wrote: > > Hi, > > It's a bit hacky, but I've used filter_horizontal outside of the admin > before. > > from django.contrib.admin import widgets > > class MyForm(forms.Form): > users =

Re: Question on Template placement in file system

2015-01-08 Thread Collin Anderson
Hi, The tutorial suggests A) (for a non-reusable app). https://docs.djangoproject.com/en/1.7/intro/tutorial02/#ref-customizing-your-projects-templates Collin On Tuesday, January 6, 2015 at 10:25:10 AM UTC-5, Tobias Dacoir wrote: > > I have been working through the official Django 1.7 tutorial

Re: Error: No module named polls

2015-01-08 Thread Collin Anderson
Hi, Question(question_text="que hay?", pub_date=timezone()) should be: Question(question_text="que hay?", pub_date=timezone.now()) Collin On Tuesday, January 6, 2015 at 9:03:32 AM UTC-5, ibes ... wrote: > > Hi, > thanks for your answer... > here is the path of my site, that i called

Re: Model to create forms

2015-01-08 Thread Javier Guerra Giraldez
On Thu, Jan 8, 2015 at 1:03 PM, Collin Anderson wrote: > 2) Also keeping all the experiments data in only one table and getting all > the information for one experiment by finding all the row with the same uid > looks a little bit a time consuming process but for now we used

Re: Django-compressor/assets not working on Heroku

2015-01-08 Thread Collin Anderson
Hi, Try this: heroku run python manage.py collectstatic --noinput https://devcenter.heroku.com/articles/django-assets#debugging Collin On Tuesday, January 6, 2015 at 6:08:17 AM UTC-5, Po Chen wrote: > > Hi there, > > I've been trying to get some automatic assets handling setup in my tiny >

Re: Model to create forms

2015-01-08 Thread Collin Anderson
Hi, 1) there is no other approach (like creating a model on the fly, that is not writing in models.py. But it looks against the way django works) and any idea is welcomed. Generally I've found that creating a real model to store the data is easiest in the long run and usually involves less

Re: Expected performance of the django development server?

2015-01-08 Thread Collin Anderson
Hi Richard, Like you've seen, the _number_ of queries often has a large effect on speed. Also, try comparing your page load time with and without debug toolbar enabled. I found that DDT is slow itself :). Collin On Monday, January 5, 2015 at 10:19:44 AM UTC-5, Richard Brockie wrote: > > Hi

Re: Filter_horizontal, applying filter on the right box - chosen items

2015-01-08 Thread Collin Anderson
Hi, It's a bit hacky, but I've used filter_horizontal outside of the admin before. from django.contrib.admin import widgets class MyForm(forms.Form): users = forms.ModelMultipleChoiceField( required=False, widget=widgets.FilteredSelectMultiple(verbose_name='Field Name',

Re: Exception occurred processing WSGI script

2015-01-08 Thread Néstor
It would be nice to read about the solution to your problem :-) On Jan 7, 2015 8:09 PM, "sarfaraz ahmed" wrote: > Issue resolved. Please close this > > On Wednesday, 7 January 2015 23:02:33 UTC+5:30, sarfaraz ahmed wrote: >> >> This is what I am trying to do. >> >> I am

Re: Deploying Django on Docker

2015-01-08 Thread Jeroen Bakker
Hi Anssi, Not really an answer to your question, but just to give you insight to a solution. We at l1nda are using docker and django with small applications and large applications. We developed an nginx container and uwsgi container and a devops container. The devops container does all

Re: django form field validation and error display

2015-01-08 Thread 赵飞
I have read the doc, what you say is helpfull, thanks! 在 2015年1月8日星期四UTC+8下午7时33分42秒,Edgar Gabaldi写道: > > There is not your problem, but maybe will be in future. The best way to > clean fields that depend of other fields is override the clean method of > form. > > >

Re: django form field validation and error display

2015-01-08 Thread Edgar Gabaldi
There is not your problem, but maybe will be in future. The best way to clean fields that depend of other fields is override the clean method of form. https://docs.djangoproject.com/en/1.7/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other On Thu, Jan 8, 2015 at 9:28

Re: django form field validation and error display

2015-01-08 Thread 赵飞
That's it! Thanks very very much, you help me a lot! 2015-01-08 19:10 GMT+08:00 James Schneider : > Oh, you are passing a URL to render() instead of a template name. Try > something like this: > > return render(request, 'signup.html', {'form': signup_form}) > > Sorry,

Re: Deploying Django on Docker

2015-01-08 Thread Mike Dewhirst
On 8/01/2015 9:45 PM, Anssi Kääriäinen wrote: For a long time I have been battling with the following problem: how to deploy Django in an easy, maintainable, secure and reliable way for small Django applications. The applications I write are mainly very low traffic, and often they are coded in a

Re: django form field validation and error display

2015-01-08 Thread James Schneider
Oh, you are passing a URL to render() instead of a template name. Try something like this: return render(request, 'signup.html', {'form': signup_form}) Sorry, didn't catch that the first time. -James On Thu, Jan 8, 2015 at 1:34 AM, 赵飞 wrote: > I want to make a signup

Re: CSRF verification failed when I use smart phone

2015-01-08 Thread Abraham Varricatt
Can it be possible that you are rendering a different template (without CSRF) for the mobile version? -Abraham V. On Thursday, January 8, 2015 2:15:21 PM UTC+5:30, Sugita Shinsuke wrote: > > Hello Vijay Khemlani > > Thank you for replying. > But, of cause I appended the tag in my form like

Re: Deploying Django on Docker

2015-01-08 Thread Guilherme Leal
Honestly, i dont have the time to participate on this project right now, but i would use a tool like this for small projects. FOR SURE. Em Thu Jan 08 2015 at 08:45:56, Anssi Kääriäinen escreveu: For a long time I have been battling with the following problem: how to > deploy

Re: I can send mail with shell but can't sent mail via view

2015-01-08 Thread James Schneider
After a bit of reflection, I actually think the 'telnet' test would be a good one to run before troubleshooting your code any further. Many ISP's block port 25 going out to the Internet because that is the default port used for SMTP communication between SMTP servers to relay mail. Spammers use

Deploying Django on Docker

2015-01-08 Thread Anssi Kääriäinen
For a long time I have been battling with the following problem: how to deploy Django in an easy, maintainable, secure and reliable way for small Django applications. The applications I write are mainly very low traffic, and often they are coded in a couple of days. Unfortunately the hardest

Re: I can send mail with shell but can't sent mail via view

2015-01-08 Thread James Schneider
Thanks. I can see from the traceback that you have EMAIL_USE_TLS set to True, but you also have EMAIL_PORT set to 25. It doesn't appear that your email server supports TLS via port 25: $ openssl s_client -starttls smtp -connect mail.pep.co.ir:25 CONNECTED(0003) didn't found starttls in

Re: How to run background application via Django

2015-01-08 Thread Mario Gudelj
Look into celery. It's the best and easiest way to run bg jobs imo On 08/01/2015 9:10 pm, "Sugita Shinsuke" wrote: > Hi there. > > I'd like to run background application. > > I coded this code. > > I wrote the urls.py and I added in the view. > > def run_junix(request): >

How to run background application via Django

2015-01-08 Thread Sugita Shinsuke
Hi there. I'd like to run background application. I coded this code. I wrote the urls.py and I added in the view. def run_junix(request): cmd = "cd app_path;nohup python background_app.py &" import subprocess proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,

Re: django form field validation and error display

2015-01-08 Thread 赵飞
I want to make a signup page, when user click signup, it will check if the two password are the same, when not, give a error message after "confirm password". But when I call "return render(request, reverse("accounts:signup"), {'form': signup_form}) " in my views.py, it shows me an error, the

Re: I can send mail with shell but can't sent mail via view

2015-01-08 Thread Hossein Rashnoo
Thank you for your reply, it seems that every thing is ok: $ nslookup mail.pep.co.ir Server: 10.252.84.50 Address:10.252.84.50#53 Non-authoritative answer: Name: mail.pep.co.ir Address: 79.175.161.174 and: $ python manage.py shell >>> import socket

Re: CSRF verification failed when I use smart phone

2015-01-08 Thread Sugita Shinsuke
Hello Vijay Khemlani Thank you for replying. But, of cause I appended the tag in my form like below {% csrf_token %} but I wonder about that using the iframe is bad. The form is child of iframe. I also checked Chrome's developer tool. The csrf token was saved in the cookie.

Re: I can send mail with shell but can't sent mail via view

2015-01-08 Thread James Schneider
Can you send the whole traceback? Name resolution errors indicate an issue with DNS reachability, or a domain name incorrectly entered somewhere. I'm assuming that you are running the shell on the same server that is running your Django instance? You should be able to do the following on the

I can send mail with shell but can't sent mail via view

2015-01-08 Thread Hossein Rashnoo
Hi I use this settings to send email: settings.py EMAIL_HOST = "mail.xx.ir" EMAIL_PORT = "25" EMAIL_HOST_USER = "xx...@xxx.ir" EMAIL_HOST_PASSWORD = "" EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' DEFAULT_FROM_EMAIL = 'xx...@xxx.ir' and in python shell: from