Re: Django with Ubuntu Cloud

2014-01-31 Thread Andreas Kuhne
Hi,

Why not use S3 for storage? Then you can still keep heroku and don't have
to make vast changes to your setup?

Regards,

Andréas


2014-01-31 Vibhu Rishi :

> Hi,
>
> Has anyone setup Django with Ubuntu Cloud ?
>
> My primary interest is how to setup the media server. I am primarily using
> Heroku for the hosting of the project, but that does not provide hosting
> for the static / user uploaded files. So, I am looking at what alternatives
> I have. There are a lot of suggestions to use AWS. I also came across
> ubuntu cloud - but havent gotten much details if i can use it with ubuntu.
>
> Thanks for your insights!
> V.
>
> --
> Simplicity is the ultimate sophistication. - Leonardo da Vinci
> Life is really simple, but we insist on making it complicated. - Confucius
>
> --
> 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/CAPiONwmd9h%2Bcwb1SYseYeiijag4Aa5weeMtg_eqiDgh7txVOKg%40mail.gmail.com
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALXYUb%3DxLaVMPLQBcvyObuR19KHQ9rkQ%3DuvWUMqafO-q_EJ%3D_w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Pre-populating data in the admin panel

2014-01-31 Thread kerviel patrice
In the Django Admin I want to populate fields for a foreign key record when 
I click the add (+) button
I tried with formfield_for_foreignkey but it does not work

model

class Property(models.Model):
name = models.CharField(_('name'), max_length=50)
description = models.TextField(_('description'), blank=True)


class Physic(models.Model):
name = models.ForeignKey(Property, verbose_name=_('name'), null=True, 
blank=True,)
lapropriete = models.CharField(_('property'), max_length=100)


class UniteProperty2(models.Model):
name = models.ForeignKey(Material, verbose_name=_('name'))  
   
nature_unit = models.ForeignKey(Property, verbose_name=_('category'))   

choix = models.ForeignKey(Physic, verbose_name=_('properties'), null=True, 
blank=True,  related_name='UniteProperty2_choix') 


forms

def formfield_for_foreignkey(self, db_field, request, **kwargs):
 
if db_field.name == 'nature_unit':
kwargs['queryset'] = Property.objects.all()
return db_field.formfield(**kwargs)
if db_field.name == 'choix':
kwargs['queryset'] = Physic.objects.all()
return db_field.formfield(**kwargs)

 
return super(UniteProperty2Inline, 
self).formfield_for_foreignkey(db_field, request, **kwargs)

-- 
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/7e356b70-4ec0-48a3-af02-3ec9c5a836ab%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


django 1.6 how does the form.as_p decide the textfield rows and and cols?

2014-01-31 Thread 项楠
http://stackoverflow.com/questions/21481229/django-1-6-how-does-the-form-as-p-decide-the-textfield-rows-and-and-cols

I have read the form.as_p method source code, still don't know.[image: 
enter image description here]

#models.py
class User(AbstractBaseUser):

description = 
models.TextField(max_length=200,blank=True,verbose_name=_('个人说明'))
#rest fields omitted...
#forms.pyclass ProfileForm(forms.ModelForm): 
class Meta:
model = User
fields = [ 'description', ]
#template.html,edit the profile{% csrf_token %}
{{form.as_p}}


this is the source code:

def _html_output(self, normal_row, error_row, row_ender, help_text_html, 
errors_on_separate_row):
"Helper function for outputting HTML. Used by as_table(), as_ul(), as_p()."
top_errors = self.non_field_errors() # Errors that should be displayed 
above all fields.
output, hidden_fields = [], []

for name, field in self.fields.items():
html_class_attr = ''
bf = self[name]
# Escape and cache in local variable.
bf_errors = self.error_class([conditional_escape(error) for error in 
bf.errors])
if bf.is_hidden:
if bf_errors:
top_errors.extend(
[_('(Hidden field %(name)s) %(error)s') % {'name': name, 
'error': force_text(e)}
 for e in bf_errors])
hidden_fields.append(six.text_type(bf))
else:
# Create a 'class="..."' atribute if the row should have any
# CSS classes applied.
css_classes = bf.css_classes()
if css_classes:
html_class_attr = ' class="%s"' % css_classes

if errors_on_separate_row and bf_errors:
output.append(error_row % force_text(bf_errors))

if bf.label:
label = conditional_escape(force_text(bf.label))
label = bf.label_tag(label) or ''
else:
label = ''

if field.help_text:
help_text = help_text_html % force_text(field.help_text)
else:
help_text = ''

output.append(normal_row % {
'errors': force_text(bf_errors),
'label': force_text(label),
'field': six.text_type(bf),
'help_text': help_text,
'html_class_attr': html_class_attr
})

-- 
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/2e0ad855-e52f-433a-ac33-a642b9a2f309%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Pre-populating data in the admin panel

2014-01-31 Thread shmengie
Add your foreign key table to the admin.py and register it.  Admin will 
magically add the (+) button.
Or add it inline and have it all on the same page. 
Depends on which is right for your application.

admin.py:

from project.models import *

class PropertyAdmin(admin.ModelAdmin):
pass
admin.site.register(Property, PropertyAdmin)

class PhysicAdmin(admin.ModelAdmin):
pass
admin.site.register(Physic, PhysicAdmin

-- 
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/5a583bfa-288a-4802-907b-fd3ceb926b9f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django with Ubuntu Cloud

2014-01-31 Thread Vibhu Rishi
It requires a CC for sign up - even for the free mode. Can't use mine here
and I don't want to get another CC.

V.
On Jan 31, 2014 1:42 PM, "Andreas Kuhne"  wrote:

> Hi,
>
> Why not use S3 for storage? Then you can still keep heroku and don't have
> to make vast changes to your setup?
>
> Regards,
>
> Andréas
>
>
> 2014-01-31 Vibhu Rishi :
>
>> Hi,
>>
>> Has anyone setup Django with Ubuntu Cloud ?
>>
>> My primary interest is how to setup the media server. I am primarily
>> using Heroku for the hosting of the project, but that does not provide
>> hosting for the static / user uploaded files. So, I am looking at what
>> alternatives I have. There are a lot of suggestions to use AWS. I also came
>> across ubuntu cloud - but havent gotten much details if i can use it with
>> ubuntu.
>>
>> Thanks for your insights!
>> V.
>>
>> --
>> Simplicity is the ultimate sophistication. - Leonardo da Vinci
>> Life is really simple, but we insist on making it complicated. -
>> Confucius
>>
>> --
>> 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/CAPiONwmd9h%2Bcwb1SYseYeiijag4Aa5weeMtg_eqiDgh7txVOKg%40mail.gmail.com
>> .
>> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALXYUb%3DxLaVMPLQBcvyObuR19KHQ9rkQ%3DuvWUMqafO-q_EJ%3D_w%40mail.gmail.com
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPiONwmrk-c3E2v6v5z7j76rxRcXp3h4CNSKAbp-LyhYVZmDnA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django with Ubuntu Cloud

2014-01-31 Thread Vibhu Rishi
Thanks Russ.
On Jan 31, 2014 12:42 PM, "Russell Keith-Magee" 
wrote:

> Hi Vibhu,
>
> Everything I know about Ubuntu Cloud I learned from their homepage in the
> last couple of minutes --  but that website seems to suggest that Ubuntu
> Cloud is based on OpenStack. OpenStack is a generic API for cloud computing
> that is shared by a number of providers (most notably Rackspace, but there
> are others), so if Ubuntu Cloud uses OpenStack, then you just need to look
> for libraries that support OpenStack, and you should be able to use those
> libraries on Ubuntu Cloud.
>
> If you're looking for an alternative to S3, then you want OpenStack Swift.
> There are Python libraries to talk to Swift stores, and there are Django
> file storage backends that will use Swift as well.
>
> Yours,
> Russ Magee %-)
>
>
>
>
>
> On Fri, Jan 31, 2014 at 2:56 PM, Vibhu Rishi wrote:
>
>> Hi,
>>
>> Has anyone setup Django with Ubuntu Cloud ?
>>
>> My primary interest is how to setup the media server. I am primarily
>> using Heroku for the hosting of the project, but that does not provide
>> hosting for the static / user uploaded files. So, I am looking at what
>> alternatives I have. There are a lot of suggestions to use AWS. I also came
>> across ubuntu cloud - but havent gotten much details if i can use it with
>> ubuntu.
>>
>> Thanks for your insights!
>> V.
>>
>> --
>> Simplicity is the ultimate sophistication. - Leonardo da Vinci
>> Life is really simple, but we insist on making it complicated. -
>> Confucius
>>
>> --
>> 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/CAPiONwmd9h%2Bcwb1SYseYeiijag4Aa5weeMtg_eqiDgh7txVOKg%40mail.gmail.com
>> .
>> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJxq84_F2HTfNAH%2BaUN-evCOm-EZBaYvnnk6iimG2-4FrMr9Mw%40mail.gmail.com
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPiONwnrZbh-RnVJhtiNaMyT1jq6wMc4%2BO7xc79QUe9Qg13bGg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django with Ubuntu Cloud

2014-01-31 Thread Vibhu Rishi
So - I can use Ubuntu One ( which seems to be like Drop box if I understand
it correctly ) as a media file storage?

V.
On Jan 31, 2014 12:47 PM, "Me Sulphur"  wrote:

> Django is a fairly flexible web framework. See read more about STATIC and
> MEDIA files in Django. The Ubuntu cloud API is documented here
> https://one.ubuntu.com/developer/files/store_files/cloud, you can
> interact with it using libraries like requests.
>
> https://docs.djangoproject.com/en/dev/howto/static-files/
>
> --
> 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/d132b6ad-1f34-4585-888e-20801e020ad0%40googlegroups.com
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPiONw%3DHWTD%3DyERPuHg60q6RsgiCdwt_skr7b%2BSUB1sbn5izRQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django with Ubuntu Cloud

2014-01-31 Thread Me Sulphur
So - I can use Ubuntu One ( which seems to be like Drop box if I understand
it correctly ) as a media file storage?

Indeed you UO is like DB and you can use their APIs to programatically PUT
and/or GET files on their system.

-- 
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/CABSvzZC5oJ5yebxqp3w85hWsXHnZMvrdTgnBm9WUPkPePGCerw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Honest feedback

2014-01-31 Thread Simon Charette
Just wanted to add/correct two points.
 

> That also means some of the warts are still there like the difficulty in 
> writing reusable apps, file based settings, multiple user profiles, that 30 
> char username length on the contrib.auth.User model. 
>

Django 1.5 ships with a configurable user 
modelto
 allow you to define a username the way you want.

There have been some changes like south becoming the defacto standard for 
> migrations...
>

Django 1.7 will ship with built-in schema 
migration
.

Le vendredi 31 janvier 2014 01:24:55 UTC-5, Doug Ballance a écrit :
>
> There have been small, well thought out changes over the last 4 years but 
> fundamentally most still remains pretty much the same.   I have several 
> installs running an patched old .96 version, as well as newer stuff with 
> later versions.  It all feels about the same to work with.   I recently 
> upgraded one from 1.3 to the current with no breakage at all.  They've 
> remained pretty true to the promise of backwards compatibility.  That also 
> means some of the warts are still there like the difficulty in writing 
> reusable apps, file based settings, multiple user profiles, that 30 char 
> username length on the contrib.auth.User model.  Todays Django is a more 
> mature, stable version of what you probably remember.
>
> There have been some changes like south becoming the defacto standard for 
> migrations, and geojango now a bundled part of django.  I think the biggest 
> thing overall is the number of 3rd party apps available  ( 
> https://www.djangopackages.com/ ).  There are some really useful ones 
> like tastypie and django rest framework for out of box API (like the admin 
> was for orm).  Celery for async tasks, several very nice CMS,  
> Authentication backends for most of the social media sites via 
> python-social-auth.  Several nice asset managers.   Some nice things in the 
> ORM too, like inheritance and a more useful select_related implementation.  
> Oh, and multiple database support!  Templates can now be cached. The 
> storages api was introduced and there are several backends for doing things 
> like uploading to amazon or other similar apis.  
>
> Sorry for the rambling, just throwing stuff out there!  
>

-- 
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/65f14f61-4880-4c35-abba-904c6c63e684%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


UnreadablePostError: request data read error

2014-01-31 Thread François Schiettecatte
Hi

I am getting the error below when users are uploading files to a website, this 
is on django 1.6.1.

What this suggests is that the client is closing the connection before the file 
is fully uploaded, ie the data cannot be read to completion.

This is happening with different browsers and seemingly on a random basis. 

What I want to know is (a) am I reading this right and (b) what I can do to pin 
down this issue?

Traceback (most recent call last):
 File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 
107, in get_response
   response = middleware_method(request, callback, callback_args, 
callback_kwargs)
 File "/usr/lib/python2.6/site-packages/django/middleware/csrf.py", line 170, 
in process_view
   request_csrf_token = request.POST.get('csrfmiddlewaretoken', '')
 File "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 
146, in _get_post
   self._load_post_and_files()
 File "/usr/lib/python2.6/site-packages/django/http/request.py", line 219, in 
_load_post_and_files
   self._post, self._files = self.parse_file_upload(self.META, data)
 File "/usr/lib/python2.6/site-packages/django/http/request.py", line 184, in 
parse_file_upload
   return parser.parse()
 File "/usr/lib/python2.6/site-packages/django/http/multipartparser.py", line 
201, in parse
   for chunk in field_stream:
 File "/usr/lib/python2.6/site-packages/django/utils/six.py", line 414, in next
   return type(self).__next__(self)
 File "/usr/lib/python2.6/site-packages/django/http/multipartparser.py", line 
330, in __next__
   output = next(self._producer)
 File "/usr/lib/python2.6/site-packages/django/utils/six.py", line 414, in next
   return type(self).__next__(self)
 File "/usr/lib/python2.6/site-packages/django/http/multipartparser.py", line 
458, in __next__
   for bytes in stream:
 File "/usr/lib/python2.6/site-packages/django/utils/six.py", line 414, in next
   return type(self).__next__(self)
 File "/usr/lib/python2.6/site-packages/django/http/multipartparser.py", line 
330, in __next__
   output = next(self._producer)
 File "/usr/lib/python2.6/site-packages/django/utils/six.py", line 414, in next
   return type(self).__next__(self)
 File "/usr/lib/python2.6/site-packages/django/http/multipartparser.py", line 
391, in __next__
   data = self.flo.read(self.chunk_size)
 File "/usr/lib/python2.6/site-packages/django/http/request.py", line 248, in 
read
   six.reraise(UnreadablePostError, UnreadablePostError(*e.args), 
sys.exc_info()[2])
 File "/usr/lib/python2.6/site-packages/django/http/request.py", line 246, in 
read
   return self._stream.read(*args, **kwargs)
 File "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 51, 
in read
   result = self.buffer + self._read_limited(size - len(self.buffer))
 File "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 39, 
in _read_limited
   result = self.stream.read(size)
UnreadablePostError: request data read error


Thanks 

François


signature.asc
Description: Message signed with OpenPGP using GPGMail


Problems Sending Email From Django SIte

2014-01-31 Thread Mark Phillips
I have my django site setup on my production server, a Debian machine with
exim4 and django 1.6. I use smtp.cox.net to relay my emails from my server.

I can send emails from the server using mutt.

I can also send an email from a python prompt in my virtual environment on
the server using this (with a different to and from address) after
importing my projects settings.py file:

>>> from django.core.mail import send_mail
>>> send_mail('Subject here', 'Here is the message.', 'f...@example.com', ['
t...@example.com'], fail_silently=False)

However, when I get an error on the site (ie self-induced), I do not get
any emails from the site. I have ADMINS setup correctly per the docs. In
settings.py I just have the basics - localhost and port 25 for email.

Perhaps the error I introduced was to severe (an import error is
settings.py). I also tried accessing a page that does not exist, and no
email.

My first question: How can I simulate/force an error on the site to get an
email so I can make sure the site can send an email to the admins?

Thanks,

Mark

-- 
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/CAEqej2OvqoZ8HSs8OrOiXUhXVWEYmDpdx_pZjedimbLajhXZaw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problems Sending Email From Django SIte

2014-01-31 Thread Mark Phillips
A follow up. After hitting send, I realized how to simulate an error - I
asked for a page with a nonexistent id. Like the polls example in the
django tutorial, I used an url with a poll_id that does not exist in my
site. I got a Server Error (500) page, but no email. I looked in the exim4
reject log and found:

2014-01-31 18:07:04 unqualified recipient rejected:  H=localhost
[127.0.0.1]

I googled this error and have not had any luck figuring it out. Since I can
send email from the command line and a python script with the same
settings.py file as my site, could I be missing something in the django
setup for sending emails to admins when there is a site error?

All I have in settings.py for email is localhost, port 25, and admins email
addresses. Do I need something else? Some module or middleware
thing-a-ma-bob? I just have the stock modules and middleware that django
created with a new project. I haven't found anything in the django docs
that point to a module that I am missing.

Thanks!

Mark


On Fri, Jan 31, 2014 at 6:06 PM, Mark Phillips
wrote:

> I have my django site setup on my production server, a Debian machine with
> exim4 and django 1.6. I use smtp.cox.net to relay my emails from my
> server.
>
> I can send emails from the server using mutt.
>
> I can also send an email from a python prompt in my virtual environment on
> the server using this (with a different to and from address) after
> importing my projects settings.py file:
>
> >>> from django.core.mail import send_mail
> >>> send_mail('Subject here', 'Here is the message.', 'f...@example.com',
> ['t...@example.com'], fail_silently=False)
>
> However, when I get an error on the site (ie self-induced), I do not get
> any emails from the site. I have ADMINS setup correctly per the docs. In
> settings.py I just have the basics - localhost and port 25 for email.
>
> Perhaps the error I introduced was to severe (an import error is
> settings.py). I also tried accessing a page that does not exist, and no
> email.
>
> My first question: How can I simulate/force an error on the site to get an
> email so I can make sure the site can send an email to the admins?
>
> Thanks,
>
> Mark
>
>

-- 
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/CAEqej2MLB-b7_cRZn7pEnCP1bTTm-zWuxyGC%3DK9UcZgMZq1pvw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problems Sending Email From Django SIte

2014-01-31 Thread m1chael
Your mail server needs configuring.

On Fri, Jan 31, 2014 at 8:15 PM, Mark Phillips
 wrote:
> A follow up. After hitting send, I realized how to simulate an error - I
> asked for a page with a nonexistent id. Like the polls example in the django
> tutorial, I used an url with a poll_id that does not exist in my site. I got
> a Server Error (500) page, but no email. I looked in the exim4 reject log
> and found:
>
> 2014-01-31 18:07:04 unqualified recipient rejected:  H=localhost
> [127.0.0.1]
>
> I googled this error and have not had any luck figuring it out. Since I can
> send email from the command line and a python script with the same
> settings.py file as my site, could I be missing something in the django
> setup for sending emails to admins when there is a site error?
>
> All I have in settings.py for email is localhost, port 25, and admins email
> addresses. Do I need something else? Some module or middleware
> thing-a-ma-bob? I just have the stock modules and middleware that django
> created with a new project. I haven't found anything in the django docs that
> point to a module that I am missing.
>
> Thanks!
>
> Mark
>
>
> On Fri, Jan 31, 2014 at 6:06 PM, Mark Phillips 
> wrote:
>>
>> I have my django site setup on my production server, a Debian machine with
>> exim4 and django 1.6. I use smtp.cox.net to relay my emails from my server.
>>
>> I can send emails from the server using mutt.
>>
>> I can also send an email from a python prompt in my virtual environment on
>> the server using this (with a different to and from address) after importing
>> my projects settings.py file:
>>
>> >>> from django.core.mail import send_mail
>> >>> send_mail('Subject here', 'Here is the message.', 'f...@example.com',
>> >>> ['t...@example.com'], fail_silently=False)
>>
>> However, when I get an error on the site (ie self-induced), I do not get
>> any emails from the site. I have ADMINS setup correctly per the docs. In
>> settings.py I just have the basics - localhost and port 25 for email.
>>
>> Perhaps the error I introduced was to severe (an import error is
>> settings.py). I also tried accessing a page that does not exist, and no
>> email.
>>
>> My first question: How can I simulate/force an error on the site to get an
>> email so I can make sure the site can send an email to the admins?
>>
>> Thanks,
>>
>> Mark
>>
>
> --
> 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/CAEqej2MLB-b7_cRZn7pEnCP1bTTm-zWuxyGC%3DK9UcZgMZq1pvw%40mail.gmail.com.
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAuoY6PmcANqfwHVeuQ7WX82%3DkHJyziQsVOpN_Wrcc5hCYj%2BCQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problems Sending Email From Django SIte

2014-01-31 Thread Mark Phillips
Thank-you for your response...However,

1. I can send email from the command line and from mutt.

2. I can send email from a python prompt using the settings.py in my app.

These two facts tell me the mail server is configured properly.

3. Only my django app cannot send email.

This fact leads me to believe my django app is mis-configured for sending
email. In all other aspects, my app works as designed.

Do you have any other helpful suggestions?

Mark


On Fri, Jan 31, 2014 at 7:26 PM, m1chael  wrote:

> Your mail server needs configuring.
>
> On Fri, Jan 31, 2014 at 8:15 PM, Mark Phillips
>  wrote:
> > A follow up. After hitting send, I realized how to simulate an error - I
> > asked for a page with a nonexistent id. Like the polls example in the
> django
> > tutorial, I used an url with a poll_id that does not exist in my site. I
> got
> > a Server Error (500) page, but no email. I looked in the exim4 reject log
> > and found:
> >
> > 2014-01-31 18:07:04 unqualified recipient rejected:  H=localhost
> > [127.0.0.1]
> >
> > I googled this error and have not had any luck figuring it out. Since I
> can
> > send email from the command line and a python script with the same
> > settings.py file as my site, could I be missing something in the django
> > setup for sending emails to admins when there is a site error?
> >
> > All I have in settings.py for email is localhost, port 25, and admins
> email
> > addresses. Do I need something else? Some module or middleware
> > thing-a-ma-bob? I just have the stock modules and middleware that django
> > created with a new project. I haven't found anything in the django docs
> that
> > point to a module that I am missing.
> >
> > Thanks!
> >
> > Mark
> >
> >
> > On Fri, Jan 31, 2014 at 6:06 PM, Mark Phillips <
> m...@phillipsmarketing.biz>
> > wrote:
> >>
> >> I have my django site setup on my production server, a Debian machine
> with
> >> exim4 and django 1.6. I use smtp.cox.net to relay my emails from my
> server.
> >>
> >> I can send emails from the server using mutt.
> >>
> >> I can also send an email from a python prompt in my virtual environment
> on
> >> the server using this (with a different to and from address) after
> importing
> >> my projects settings.py file:
> >>
> >> >>> from django.core.mail import send_mail
> >> >>> send_mail('Subject here', 'Here is the message.', 'f...@example.com
> ',
> >> >>> ['t...@example.com'], fail_silently=False)
> >>
> >> However, when I get an error on the site (ie self-induced), I do not get
> >> any emails from the site. I have ADMINS setup correctly per the docs. In
> >> settings.py I just have the basics - localhost and port 25 for email.
> >>
> >> Perhaps the error I introduced was to severe (an import error is
> >> settings.py). I also tried accessing a page that does not exist, and no
> >> email.
> >>
> >> My first question: How can I simulate/force an error on the site to get
> an
> >> email so I can make sure the site can send an email to the admins?
> >>
> >> Thanks,
> >>
> >> Mark
> >>
> >
> > --
> > 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/CAEqej2MLB-b7_cRZn7pEnCP1bTTm-zWuxyGC%3DK9UcZgMZq1pvw%40mail.gmail.com
> .
> >
> > 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAuoY6PmcANqfwHVeuQ7WX82%3DkHJyziQsVOpN_Wrcc5hCYj%2BCQ%40mail.gmail.com
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEqej2Oh2UKAic%3DS1FTNpsXaO474JrYzEH3Co%3DBPvpAMifEc5w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problems Sending Email From Django SIte

2014-01-31 Thread m1chael
can you tail a mail server log file, while trying to send a django
e-mail, and see what happens? also take a look at a log file for
command line and mutt do a comparison of all. maybe that will help

On Fri, Jan 31, 2014 at 10:35 PM, Mark Phillips
 wrote:
> Thank-you for your response...However,
>
> 1. I can send email from the command line and from mutt.
>
> 2. I can send email from a python prompt using the settings.py in my app.
>
> These two facts tell me the mail server is configured properly.
>
> 3. Only my django app cannot send email.
>
> This fact leads me to believe my django app is mis-configured for sending
> email. In all other aspects, my app works as designed.
>
> Do you have any other helpful suggestions?
>
> Mark
>
>
> On Fri, Jan 31, 2014 at 7:26 PM, m1chael  wrote:
>>
>> Your mail server needs configuring.
>>
>> On Fri, Jan 31, 2014 at 8:15 PM, Mark Phillips
>>  wrote:
>> > A follow up. After hitting send, I realized how to simulate an error - I
>> > asked for a page with a nonexistent id. Like the polls example in the
>> > django
>> > tutorial, I used an url with a poll_id that does not exist in my site. I
>> > got
>> > a Server Error (500) page, but no email. I looked in the exim4 reject
>> > log
>> > and found:
>> >
>> > 2014-01-31 18:07:04 unqualified recipient rejected:  H=localhost
>> > [127.0.0.1]
>> >
>> > I googled this error and have not had any luck figuring it out. Since I
>> > can
>> > send email from the command line and a python script with the same
>> > settings.py file as my site, could I be missing something in the django
>> > setup for sending emails to admins when there is a site error?
>> >
>> > All I have in settings.py for email is localhost, port 25, and admins
>> > email
>> > addresses. Do I need something else? Some module or middleware
>> > thing-a-ma-bob? I just have the stock modules and middleware that django
>> > created with a new project. I haven't found anything in the django docs
>> > that
>> > point to a module that I am missing.
>> >
>> > Thanks!
>> >
>> > Mark
>> >
>> >
>> > On Fri, Jan 31, 2014 at 6:06 PM, Mark Phillips
>> > 
>> > wrote:
>> >>
>> >> I have my django site setup on my production server, a Debian machine
>> >> with
>> >> exim4 and django 1.6. I use smtp.cox.net to relay my emails from my
>> >> server.
>> >>
>> >> I can send emails from the server using mutt.
>> >>
>> >> I can also send an email from a python prompt in my virtual environment
>> >> on
>> >> the server using this (with a different to and from address) after
>> >> importing
>> >> my projects settings.py file:
>> >>
>> >> >>> from django.core.mail import send_mail
>> >> >>> send_mail('Subject here', 'Here is the message.',
>> >> >>> 'f...@example.com',
>> >> >>> ['t...@example.com'], fail_silently=False)
>> >>
>> >> However, when I get an error on the site (ie self-induced), I do not
>> >> get
>> >> any emails from the site. I have ADMINS setup correctly per the docs.
>> >> In
>> >> settings.py I just have the basics - localhost and port 25 for email.
>> >>
>> >> Perhaps the error I introduced was to severe (an import error is
>> >> settings.py). I also tried accessing a page that does not exist, and no
>> >> email.
>> >>
>> >> My first question: How can I simulate/force an error on the site to get
>> >> an
>> >> email so I can make sure the site can send an email to the admins?
>> >>
>> >> Thanks,
>> >>
>> >> Mark
>> >>
>> >
>> > --
>> > 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/CAEqej2MLB-b7_cRZn7pEnCP1bTTm-zWuxyGC%3DK9UcZgMZq1pvw%40mail.gmail.com.
>> >
>> > 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAAuoY6PmcANqfwHVeuQ7WX82%3DkHJyziQsVOpN_Wrcc5hCYj%2BCQ%40mail.gmail.com.
>>
>> 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@googleg