Re: migrations to custom user model - complex project

2014-01-27 Thread Frank Bieniek

Thanks Arnold, for the details.

Am 25.01.14 21:22, schrieb Arnold Krille:

We did something similar, we switched from djangos own user model + our
profile to just using our profile extended by email and password (no
username anymore and no openid (yet)).

What you need to do depends on whether you can keep the ID's the same
or not. We couldn't so we had to do the following:
  - In all models that had a foreignkey on the django-user, we added
another foreignkey on the new user (with default=null).
  - Then we added a data-migration to fill the columns for the new
user-model with the ids.
  - In the next migration we deactivated all triggers for the
transaction, removed the constraints for the old django-user
reference and added constraints for the new user-model.
  - Then the references to the old django-user can be removed. And once
you defined your user model for django.auth, you have to write your
own migration to drop the user-model tables from django.auth
(because south doesn't see that table and model anymore).
  - We also renamed the references to the new user-model to be same as
the references to the old user-model before all these migrations. So
most code didn't need changing.
  - Of course you also have to adopt your python code for the
specialties of the new user model...

If you can keep the IDs the same as before, you probably don't need to
add a second column for the new model reference. You can 'just' remove
the constraints from each foreignkey pointing to the old user-model and
replace it with a constraint pointing to the new user-model. Of course,
before you do that you need a migration creating your new user-model
and a data-migration to copy the user-data (most importantly the IDs!)
to the new tables.

Maybe that helps,

- Arnold


--
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/52E63E2F.3010406%40produktlaunch.de.
For more options, visit https://groups.google.com/groups/opt_out.


time problem in django 1.6

2014-01-27 Thread Hossain Aboutalebi
I am one of the new user in django 1.6 but one thing very bad I have 
noticed in this version of django is that time.strftime("%H:%M:%S") does 
not working and giving a wrong time in my view . Is there any alternating 
approach for getting a right time in django view or not ?

Note : if you type print(time.strftime("%H:%M:%S")) in python 3 you will 
see a right time but in django 1.6 it is not true

-- 
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/fba065bb-0490-4a42-b85f-2e3fef254132%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


I nedd help - first Django app, part 2 - Admin - Adding related objects

2014-01-27 Thread Rafał Szymański
Hello everybody.
I'm Rafał. I just started learnig and I'd like to ask You for little help.
I'm in the part 2 of tutorial - admin, Adding related objects.
I have no three slots for related Choices.
Here is my code.
Thanks in advance for any help.

from django.contrib import admin
from polls.models import Choice, Poll

class ChoiceInline(admin.StackedInline):
model = Choice
extra = 3

class PollAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['question']}),
('Date information', {'fields': ['pub_date'], 'classes': 
['collapse']}),
]
inline = [ChoiceInline]
list_display = ('question', 'pub_date', 'was_published_recently')

admin.site.register(Poll, PollAdmin)

-- 
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/ebe4c00a-8e9d-4337-8d6d-0f51861f78b2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: I nedd help - first Django app, part 2 - Admin - Adding related objects

2014-01-27 Thread Ramiro Morales
On Mon, Jan 27, 2014 at 7:54 AM, Rafał Szymański  wrote:
> Hello everybody.
> I'm Rafał. I just started learnig and I'd like to ask You for little help.
> I'm in the part 2 of tutorial - admin, Adding related objects.
> I have no three slots for related Choices.
> Here is my code.
> [snip]
> class PollAdmin(admin.ModelAdmin):
> ...
> inline = [ChoiceInline]

The correct option name here is 'inlines':

 inlines = [ChoiceInline]

-- 
Ramiro Morales
@ramiromorales

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


Re: time problem in django 1.6

2014-01-27 Thread Tom Lockhart
I am not using 1.6 yet. However, you will likely get the best help if you can 
describe more exactly your symptoms. What does "giving a wrong time" actually 
look like? Are the fields scrambled? Is there a time offset to the result? Or 
something else?? Please be specific on what you are finding and why you think 
it is wrong.

hth

   - Tom

On 2014-01-27, at 12:21 AM, Hossain Aboutalebi  
wrote:

> I am one of the new user in django 1.6 but one thing very bad I have noticed 
> in this version of django is that time.strftime("%H:%M:%S") does not working 
> and giving a wrong time in my view . Is there any alternating approach for 
> getting a right time in django view or not ?
> 
> Note : if you type print(time.strftime("%H:%M:%S")) in python 3 you will see 
> a right time but in django 1.6 it is not true
> 
> -- 
> 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/fba065bb-0490-4a42-b85f-2e3fef254132%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/0A2A4051-6454-4DCA-85C5-EBA68BC220BD%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Problem installing Django on AWS EC2 Ubuntu 12.04

2014-01-27 Thread Feyzi Bagirov


I used these instructions http://nickpolet.com/blog/1/  to install Django 
on AWS EC2 t1.micro instance.

It went well until I restarted apache and was supposed to see the initial 
Django page at the Public DNS address: "Now if you view the servers Public 
DNS in your browser you should see the default django page telling you that 
'it worked'. If you do not see this page, then make sure you have allowed 
port 80 through on the AWS Security Group that the instance has been 
assigned. If that doesn't work then see below."

I do not see the page. I allowed port 80 to the security group, but it is 
still not showing. What else can be done?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/328d10dc-30ad-477d-8ba2-73aa8ad3175a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: I nedd help - first Django app, part 2 - Admin - Adding related objects

2014-01-27 Thread Rafał Szymański
as usual...

Thank you Ramiro for your effort

W dniu poniedziałek, 27 stycznia 2014 14:14:14 UTC+1 użytkownik Ramiro 
Morales napisał:
>
> On Mon, Jan 27, 2014 at 7:54 AM, Rafał Szymański 
> > 
> wrote: 
> > Hello everybody. 
> > I'm Rafał. I just started learnig and I'd like to ask You for little 
> help. 
> > I'm in the part 2 of tutorial - admin, Adding related objects. 
> > I have no three slots for related Choices. 
> > Here is my code. 
> > [snip] 
> > class PollAdmin(admin.ModelAdmin): 
> > ... 
> > inline = [ChoiceInline] 
>
> The correct option name here is 'inlines': 
>
>  inlines = [ChoiceInline] 
>
> -- 
> Ramiro Morales 
> @ramiromorales 
>

-- 
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/30d66915-407d-4d9d-9768-abefda839c0c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


can't compare datetime.datetime to datetime.date

2014-01-27 Thread Rafał Szymański
Hi again

I wolud like ask another question.
If someone would be so kind and help that will be great.
I'm in the begining of django tutorial.

I use python3.3 and django1.6

I get error:
can't compare datetime.datetime to datetime.date

Here is my code:

import datetime
from django.utils import timezone
from django.db import models

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateField('date published')
def was_published_recently(self):
return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
def __str__(self):
return self.question

class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
def __str__(self):
return self.choice_text

Thanks in advance
Rafał

-- 
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/0a985ef1-4b69-44d3-9523-c3e1ab23c8e0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problems Setting Up wsgi and Apache

2014-01-27 Thread Mark Phillips
Fred,

Thanks for your help. I made some progress so far.

1. I discovered that I fogot to add the port 7000 to Apache´s ports.conf.

2. The Apache error logs were in /var/log/apache2/error.log and not in
/var/log/apache2/mom/error.log. APACHE_LOG_DIR was not set.

2. Once I found the error logs, I found this -

[Sun Jan 26 06:25:04.325511 2014] [:warn] [pid 3472] mod_wsgi: Compiled for
Python/2.7.5+.
[Sun Jan 26 06:25:04.325576 2014] [:warn] [pid 3472] mod_wsgi: Runtime
using Python/2.7.6.

I tried removing mod-python as recommended by the django docs, but that did
not help. So I removed the Debian package for python-wsgi and compiled
python-wsgi myself.

I am not at the point where I get Forbidden - You don have permission to
access /mom/inventory on this server. This is progress!! ;)

I guess the current problem is that I cannot run the django app from a user
account (/home/django/). I added the user django to the group www-data, but
I still get the forbidden message. I will try moving it to /var/www as you
have it set up.

Thanks again!

Mark

P.S. I got a good chuckle from your signature block - "Open Source: Without
walls and fences, we need no Windows or Gates." A small nit, but I believe
it should read ..., we need no Windows nor Gates... to be grammatically
correct.


On Sun, Jan 26, 2014 at 7:43 PM, Fred Stluka  wrote:

>  Mark,
>
> I'm doing this fine with Django 1.4.2 and Python 2.7.3.
>
> My wsgi.py file looks like:
>
>
> import django.core.handlers.wsgi
>
> application = django.core.handlers.wsgi.WSGIHandler()
>
>
>
> My Apache config looks like:
>
>
>
> # WSGI setup, for use by Django and other Python webapps
> # See notes in:
> #  - http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
> #  - http://code.google.com/p/modwsgi/wiki/ConfigurationIssues
> #  - https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi
> # --Fred 11/22/2012
> WSGIPythonHome /var/python27/virtualenvs/hhl
> 
> Order allow,deny
> Allow from all
> 
> WSGIDaemonProcess wsgi_apps processes=2 threads=15 display-name=%{GROUP}
> WSGIProcessGroup  wsgi_apps
> WSGIScriptAlias   /mypythonapp "/var/www/wsgi-bin/mypythonapp.wsgi"
> WSGISocketPrefix  run/wsgi
>
> #
> # hhlweb Django app
> #
> 
>
> Order deny,allow
> Allow from all
> 
> WSGIDaemonProcess hhlweb processes=2 threads=15 display-name=%{GROUP}
> WSGIProcessGroup  hhlweb
> # Note: Support both aliases for backward compatibility with release 1.
> WSGIScriptAlias /hhlweb /var/www/django/hhlweb/apache/django.wsgi
> WSGIScriptAlias /   /var/www/django/hhlweb/apache/django.wsgi
>
> # Map the Django STATIC_URL to the Django STATIC_ROOT
> 
>
> Order deny,allow
> Allow from all
> 
> Alias /static/ /var/www/django/hhlweb/collected_static/
>
> # Map the Django MEDIA_URL to the Django MEDIA_ROOT
> 
>
> Order deny,allow
> Allow from all
> 
> Alias /media/ /var/www/django/hhlweb/media/
>
>
>
> Hope this helps!
> --Fred
> --
> Fred Stluka -- mailto:f...@bristle.com  --
> http://bristle.com/~fred/
> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
> Open Source: Without walls and fences, we need no Windows or Gates.
> --
>
> On 1/26/14 5:15 PM, Mark Phillips wrote:
>
> I have my first django app running using runserver. I am now trying to
> get Apache to serve my site. I have read the django docs and quite a few
> other references on the Internet, but I cannot get Apache to do anything
> with my django site. And no error message.
>
>  I am running django 1.6 in a virtual environment with Python 2.7 on
> Debian Linux inside my LAN.
>
>  Configuration file for apache
> /etc/apache2/sites-enabled/mom.conf:
>  
> ServerName beagle
> ServerAlias beagle
> ServerAdmin mark@beagle
>
> DocumentRoot /var/www/mom
>
>  WSGIScriptAlias /mom
> /home/django/django_projects/inventory/inventory_project/wsgi.py
>
>  
> Order deny,allow
> Allow from all
> 
>
>  ErrorLog ${APACHE_LOG_DIR}/mom/error.log
> LogLevel warn
>
>  CustomLog ${APACHE_LOG_DIR}/mom/access.log combined
> 
>
>  /home/django/django_projects/inventory/inventory_project/wsgi.py
>  import os
> os.environ.setdefault("DJANGO_SETTINGS_MODULE",
> "inventory_project.settings.dev")
>
>  from django.core.wsgi import get_wsgi_application
> application = get_wsgi_application()
>
>  The project layout:
>  /home/django/django_projects/
> └── inventory
> ├── fabfile2.py
> ├── fabfile.py
> ├── inventory
> │   ├── admin.py
> │   ├── admin.py~
> │   ├── admin.pyc
> │   ├── forms.py
> │   ├── __init__.py
> │   ├── __init__.pyc
> │   ├── migrations
> │   ├── models.py
> │   ├── models.py~
> │   ├── models.pyc
> │   ├── templates
> │   ├── templatetags
> │   ├── tests.py
> │   ├── urls.py
> │   ├── urls.py~
> │   ├── urls.pyc
> │   ├── views.py
> │   ├── views.py~
> │   └── views.pyc

Re: Problem installing Django on AWS EC2 Ubuntu 12.04

2014-01-27 Thread Avraham Serour
what do you see then?


On Mon, Jan 27, 2014 at 3:27 PM, Feyzi Bagirov  wrote:

> I used these instructions http://nickpolet.com/blog/1/  to install Django
> on AWS EC2 t1.micro instance.
>
> It went well until I restarted apache and was supposed to see the initial
> Django page at the Public DNS address: "Now if you view the servers Public
> DNS in your browser you should see the default django page telling you that
> 'it worked'. If you do not see this page, then make sure you have allowed
> port 80 through on the AWS Security Group that the instance has been
> assigned. If that doesn't work then see below."
>
> I do not see the page. I allowed port 80 to the security group, but it is
> still not showing. What else can be done?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/328d10dc-30ad-477d-8ba2-73aa8ad3175a%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/CAFWa6tJwfP6E4QxD4KndypDT380-dm-p%2B4M1tbNXVgw98MRWpQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problems Setting Up wsgi and Apache

2014-01-27 Thread Timothy W. Cook
Mark,
I don't know if this will help.  But I found (on CentOS) I had to add the
'apache' user to the django users group.  Not that it should matter, but it
seemed to.  This seemed to be easier to add group rw permissions to the
django app directory.

HTH,
Tim



On Mon, Jan 27, 2014 at 2:01 PM, Mark Phillips
wrote:

> Fred,
>
> Thanks for your help. I made some progress so far.
>
> 1. I discovered that I fogot to add the port 7000 to Apache´s ports.conf.
>
> 2. The Apache error logs were in /var/log/apache2/error.log and not in
> /var/log/apache2/mom/error.log. APACHE_LOG_DIR was not set.
>
> 2. Once I found the error logs, I found this -
>
> [Sun Jan 26 06:25:04.325511 2014] [:warn] [pid 3472] mod_wsgi: Compiled
> for Python/2.7.5+.
> [Sun Jan 26 06:25:04.325576 2014] [:warn] [pid 3472] mod_wsgi: Runtime
> using Python/2.7.6.
>
> I tried removing mod-python as recommended by the django docs, but that
> did not help. So I removed the Debian package for python-wsgi and compiled
> python-wsgi myself.
>
> I am not at the point where I get Forbidden - You don have permission to
> access /mom/inventory on this server. This is progress!! ;)
>
> I guess the current problem is that I cannot run the django app from a
> user account (/home/django/). I added the user django to the group
> www-data, but I still get the forbidden message. I will try moving it to
> /var/www as you have it set up.
>
> Thanks again!
>
> Mark
>
> P.S. I got a good chuckle from your signature block - "Open Source:
> Without walls and fences, we need no Windows or Gates." A small nit, but I
> believe it should read ..., we need no Windows nor Gates... to be
> grammatically correct.
>
>
> On Sun, Jan 26, 2014 at 7:43 PM, Fred Stluka  wrote:
>
>>  Mark,
>>
>> I'm doing this fine with Django 1.4.2 and Python 2.7.3.
>>
>> My wsgi.py file looks like:
>>
>>
>> import django.core.handlers.wsgi
>>
>> application = django.core.handlers.wsgi.WSGIHandler()
>>
>>
>>
>> My Apache config looks like:
>>
>>
>>
>> # WSGI setup, for use by Django and other Python webapps
>> # See notes in:
>> #  - http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
>> #  - http://code.google.com/p/modwsgi/wiki/ConfigurationIssues
>> #  - https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi
>> # --Fred 11/22/2012
>> WSGIPythonHome /var/python27/virtualenvs/hhl
>> 
>> Order allow,deny
>> Allow from all
>> 
>> WSGIDaemonProcess wsgi_apps processes=2 threads=15 display-name=%{GROUP}
>> WSGIProcessGroup  wsgi_apps
>> WSGIScriptAlias   /mypythonapp "/var/www/wsgi-bin/mypythonapp.wsgi"
>> WSGISocketPrefix  run/wsgi
>>
>> #
>> # hhlweb Django app
>> #
>> 
>>
>> Order deny,allow
>> Allow from all
>> 
>> WSGIDaemonProcess hhlweb processes=2 threads=15 display-name=%{GROUP}
>> WSGIProcessGroup  hhlweb
>> # Note: Support both aliases for backward compatibility with release 1.
>> WSGIScriptAlias /hhlweb /var/www/django/hhlweb/apache/django.wsgi
>> WSGIScriptAlias /   /var/www/django/hhlweb/apache/django.wsgi
>>
>> # Map the Django STATIC_URL to the Django STATIC_ROOT
>> 
>>
>> Order deny,allow
>> Allow from all
>> 
>> Alias /static/ /var/www/django/hhlweb/collected_static/
>>
>> # Map the Django MEDIA_URL to the Django MEDIA_ROOT
>> 
>>
>> Order deny,allow
>> Allow from all
>> 
>> Alias /media/ /var/www/django/hhlweb/media/
>>
>>
>>
>> Hope this helps!
>> --Fred
>> --
>> Fred Stluka -- mailto:f...@bristle.com  --
>> http://bristle.com/~fred/
>> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
>> Open Source: Without walls and fences, we need no Windows or Gates.
>> --
>>
>> On 1/26/14 5:15 PM, Mark Phillips wrote:
>>
>> I have my first django app running using runserver. I am now trying to
>> get Apache to serve my site. I have read the django docs and quite a few
>> other references on the Internet, but I cannot get Apache to do anything
>> with my django site. And no error message.
>>
>>  I am running django 1.6 in a virtual environment with Python 2.7 on
>> Debian Linux inside my LAN.
>>
>>  Configuration file for apache
>> /etc/apache2/sites-enabled/mom.conf:
>>  
>> ServerName beagle
>> ServerAlias beagle
>> ServerAdmin mark@beagle
>>
>> DocumentRoot /var/www/mom
>>
>>  WSGIScriptAlias /mom
>> /home/django/django_projects/inventory/inventory_project/wsgi.py
>>
>>  
>> Order deny,allow
>> Allow from all
>> 
>>
>>  ErrorLog ${APACHE_LOG_DIR}/mom/error.log
>> LogLevel warn
>>
>>  CustomLog ${APACHE_LOG_DIR}/mom/access.log combined
>> 
>>
>>  /home/django/django_projects/inventory/inventory_project/wsgi.py
>>  import os
>> os.environ.setdefault("DJANGO_SETTINGS_MODULE",
>> "inventory_project.settings.dev")
>>
>>  from django.core.wsgi import get_wsgi_application
>> application = get_wsgi_application()
>>
>>  The project layout:
>>  /home/django/django_projects/
>> └── inventory
>> ├── fabfile2

Re: Problem installing Django on AWS EC2 Ubuntu 12.04

2014-01-27 Thread Feyzi Bagirov
Actually, I just fixed it - I didn't grant access to port 80 in the
security group. Now it works!
Before, I saw "Page not found".
Thanks!


On Mon, Jan 27, 2014 at 6:48 PM, Avraham Serour  wrote:

> what do you see then?
>
>
> On Mon, Jan 27, 2014 at 3:27 PM, Feyzi Bagirov wrote:
>
>> I used these instructions http://nickpolet.com/blog/1/  to install
>> Django on AWS EC2 t1.micro instance.
>>
>> It went well until I restarted apache and was supposed to see the initial
>> Django page at the Public DNS address: "Now if you view the servers Public
>> DNS in your browser you should see the default django page telling you that
>> 'it worked'. If you do not see this page, then make sure you have allowed
>> port 80 through on the AWS Security Group that the instance has been
>> assigned. If that doesn't work then see below."
>>
>> I do not see the page. I allowed port 80 to the security group, but it is
>> still not showing. What else can be done?
>>
>> Thanks!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/328d10dc-30ad-477d-8ba2-73aa8ad3175a%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/_-DJKxROJZA/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAFWa6tJwfP6E4QxD4KndypDT380-dm-p%2B4M1tbNXVgw98MRWpQ%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/CADYQ1c2kPSLS_BFk6E%3Dk1AmzB7ju_-Vw%3DN2vLvFBOBaQwq1GOg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


failure of auto increment in inndb (mysql)

2014-01-27 Thread Malik Rumi
I read this on the django project site: 
>
> Since MySQL 5.5.5, the default storage engine is 
> InnoDB. 
> This engine is fully transactional and supports foreign key references. 
> It’s probably the best choice at this point. However, note that the the 
> InnoDB autoincrement counter is lost on a MySQL restart because it does not 
> remember the AUTO_INCREMENT value, instead recreating it as “max(id)+1”. 
> This may result in an inadvertent reuse of 
> AutoField
>  values.

Now to my newby senses, this is a huge problem. How can you have a primary 
key, or a foreign key, without the assurance that they are unique? But I 
did some searching around the net, and while there are some suggested fixes 
here and there, no one seems to be in a panic about this. So, my question 
is, why? Are unique primary keys not as important as I thought they were? 
How are you dealing with this, if you use mysql/innodb? Is this a reason to 
jump to nosql? Help me wrap my brain around this. Thanks.  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ac13c90b-bed2-488b-b145-3a7cde034b3a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problems Setting Up wsgi and Apache

2014-01-27 Thread Mark Phillips
Tim,

I actually tried a symbolic link from my user account
/home/django/django_app to /var/www/mom/myapp and apache is now reading the
files and I have moved beyond the Forbidden error.

However, I now get an internal server error (which is an improvement!!).
Apache is reading the wsgi.py file, but barfs at importing
django.core.wsgi.

ImportError: No module named django.core.wsgi

I have this at the top of the apache conf file for the site -
WSGIPythonPath
/home/django/.virtualenvs/inventory_project/lib/python2.7/site-packages/

which is the correct path to the site packages directory. Perhaps another
permissions problem?

Thanks,

Mark


On Mon, Jan 27, 2014 at 9:11 AM, Timothy W. Cook  wrote:

> Mark,
> I don't know if this will help.  But I found (on CentOS) I had to add the
> 'apache' user to the django users group.  Not that it should matter, but it
> seemed to.  This seemed to be easier to add group rw permissions to the
> django app directory.
>
> HTH,
> Tim
>
>
>
> On Mon, Jan 27, 2014 at 2:01 PM, Mark Phillips  > wrote:
>
>> Fred,
>>
>> Thanks for your help. I made some progress so far.
>>
>> 1. I discovered that I fogot to add the port 7000 to Apache´s ports.conf.
>>
>> 2. The Apache error logs were in /var/log/apache2/error.log and not in
>> /var/log/apache2/mom/error.log. APACHE_LOG_DIR was not set.
>>
>> 2. Once I found the error logs, I found this -
>>
>> [Sun Jan 26 06:25:04.325511 2014] [:warn] [pid 3472] mod_wsgi: Compiled
>> for Python/2.7.5+.
>> [Sun Jan 26 06:25:04.325576 2014] [:warn] [pid 3472] mod_wsgi: Runtime
>> using Python/2.7.6.
>>
>> I tried removing mod-python as recommended by the django docs, but that
>> did not help. So I removed the Debian package for python-wsgi and compiled
>> python-wsgi myself.
>>
>> I am not at the point where I get Forbidden - You don have permission to
>> access /mom/inventory on this server. This is progress!! ;)
>>
>> I guess the current problem is that I cannot run the django app from a
>> user account (/home/django/). I added the user django to the group
>> www-data, but I still get the forbidden message. I will try moving it to
>> /var/www as you have it set up.
>>
>> Thanks again!
>>
>> Mark
>>
>> P.S. I got a good chuckle from your signature block - "Open Source:
>> Without walls and fences, we need no Windows or Gates." A small nit, but I
>> believe it should read ..., we need no Windows nor Gates... to be
>> grammatically correct.
>>
>>
>> On Sun, Jan 26, 2014 at 7:43 PM, Fred Stluka  wrote:
>>
>>>  Mark,
>>>
>>> I'm doing this fine with Django 1.4.2 and Python 2.7.3.
>>>
>>> My wsgi.py file looks like:
>>>
>>>
>>> import django.core.handlers.wsgi
>>>
>>> application = django.core.handlers.wsgi.WSGIHandler()
>>>
>>>
>>>
>>> My Apache config looks like:
>>>
>>>
>>>
>>> # WSGI setup, for use by Django and other Python webapps
>>> # See notes in:
>>> #  - http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
>>> #  - http://code.google.com/p/modwsgi/wiki/ConfigurationIssues
>>> #  - https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi
>>> # --Fred 11/22/2012
>>> WSGIPythonHome /var/python27/virtualenvs/hhl
>>> 
>>> Order allow,deny
>>> Allow from all
>>> 
>>> WSGIDaemonProcess wsgi_apps processes=2 threads=15 display-name=%{GROUP}
>>> WSGIProcessGroup  wsgi_apps
>>> WSGIScriptAlias   /mypythonapp "/var/www/wsgi-bin/mypythonapp.wsgi"
>>> WSGISocketPrefix  run/wsgi
>>>
>>> #
>>> # hhlweb Django app
>>> #
>>> 
>>>
>>> Order deny,allow
>>> Allow from all
>>> 
>>> WSGIDaemonProcess hhlweb processes=2 threads=15 display-name=%{GROUP}
>>> WSGIProcessGroup  hhlweb
>>> # Note: Support both aliases for backward compatibility with release 1.
>>> WSGIScriptAlias /hhlweb /var/www/django/hhlweb/apache/django.wsgi
>>> WSGIScriptAlias /   /var/www/django/hhlweb/apache/django.wsgi
>>>
>>> # Map the Django STATIC_URL to the Django STATIC_ROOT
>>> 
>>>
>>> Order deny,allow
>>> Allow from all
>>> 
>>> Alias /static/ /var/www/django/hhlweb/collected_static/
>>>
>>> # Map the Django MEDIA_URL to the Django MEDIA_ROOT
>>> 
>>>
>>> Order deny,allow
>>> Allow from all
>>> 
>>> Alias /media/ /var/www/django/hhlweb/media/
>>>
>>>
>>>
>>> Hope this helps!
>>> --Fred
>>> --
>>> Fred Stluka -- mailto:f...@bristle.com  --
>>> http://bristle.com/~fred/
>>> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
>>> Open Source: Without walls and fences, we need no Windows or Gates.
>>> --
>>>
>>> On 1/26/14 5:15 PM, Mark Phillips wrote:
>>>
>>> I have my first django app running using runserver. I am now trying to
>>> get Apache to serve my site. I have read the django docs and quite a few
>>> other references on the Internet, but I cannot get Apache to do anything
>>> with my django site. And no error message.
>>>
>>>  I am running django 1.6 in a virtual environment with Python 2.7 on
>>> Debian Linux inside my LAN.
>>>
>>>  Configuration file 

Re: can't compare datetime.datetime to datetime.date

2014-01-27 Thread ian
You're comparing pub_date, which is a datetime.date, to timezone.now(), 
which is a datetime.datetime. Check the docs 
at http://docs.python.org/2/library/datetime.html for more.

In order to convert timezone.now() to a date, just call 
timezone.now().date(), like:

In [1]: from django.utils import timezone

In [3]: timezone.now()

Out[3]: datetime.datetime(2014, 1, 27, 14, 42, 29, 408491, tzinfo=)

In [4]: timezone.now().date()

Out[4]: datetime.date(2014, 1, 27)

On Monday, January 27, 2014 5:38:20 AM UTC-8, Rafał Szymański wrote:
>
> Hi again
>
> I wolud like ask another question.
> If someone would be so kind and help that will be great.
> I'm in the begining of django tutorial.
>
> I use python3.3 and django1.6
>
> I get error:
> can't compare datetime.datetime to datetime.date
>
> Here is my code:
>
> import datetime
> from django.utils import timezone
> from django.db import models
>
> class Poll(models.Model):
> question = models.CharField(max_length=200)
> pub_date = models.DateField('date published')
> def was_published_recently(self):
> return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
> def __str__(self):
> return self.question
>
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice_text = models.CharField(max_length=200)
> votes = models.IntegerField(default=0)
> def __str__(self):
> return self.choice_text
>
> Thanks in advance
> Rafał
>

-- 
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/a91997c8-faea-49b3-a75f-2a32e81bf9ca%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problems Setting Up wsgi and Apache

2014-01-27 Thread Timothy W. Cook
On Mon, Jan 27, 2014 at 2:22 PM, Mark Phillips
wrote:

>
> I have this at the top of the apache conf file for the site -
> WSGIPythonPath
> /home/django/.virtualenvs/inventory_project/lib/python2.7/site-packages/
>
> which is the correct path to the site packages directory. Perhaps another
> permissions problem?
>
>
Could be.  I would certainly check that you have correct group read
permissions down the entire path.

-- 
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/CA%2B%3DOU3VrJ_hctM0rCVKjfDU6zVtBXSMkXjSQEy_4uPtFY%3DVSKg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problems Setting Up wsgi and Apache

2014-01-27 Thread Fred Stluka

Mark,

Most likely your Apache server is running as user "apache" in
group "apache", and your Django code is being called by the
Apache server via WSGI, so it is also running as user "apache".

True?

If so, make sure that the files and directories needed by the
Apache and Django code are all accessible to user "apache".

P.S.  "or" vs "nor" -- Yeah, I have a VERY strong background in
English grammar.  Partly because it was beaten into me by
the nuns, and party because I'm such a fundamentally nerdy
engineer type that I found the technique of "diagramming a
sentence" to be fascinating and even fun.

So, I know the difference between an adjective and an adverb,
can cite things like the "present perfect tense", know what a
"dangling participle" is and that you are not supposed to end
a sentence with a preposition, etc.

But, the vast majority of people I meet seem to agree  with
Churchill that such rules are things "up with which we shall
not put" [1], so I rarely correct anyone any more, and have
come to recognize that language is a living evolving thing.
The most common usage is by definition the correct usage,
despite what it says in the Oxford English Dictionary (six
inches thick), "Warriner's English Grammar and Composition",
or the "MLA Handbook" -- all sitting within reach of me
right now).

[1] http://public.wsu.edu/~brians/errors/churchill.html

In fact, I pretty much avoid ever using "nor" or "whom"
because people notice when I do, and change their opinion
of me slightly away from hard-hitting, down-to-earth
engineer, and towards ivory tower academic.

Also, I decided many years ago to never use a full sentence
when a simple phrase will do.

Anyhow, good luck with your Django/WSGI setup!

Any more problems, speak up.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 1/27/14 11:01 AM, Mark Phillips wrote:

Fred,

Thanks for your help. I made some progress so far.

1. I discovered that I fogot to add the port 7000 to Apache´s ports.conf.

2. The Apache error logs were in /var/log/apache2/error.log and not in 
/var/log/apache2/mom/error.log. APACHE_LOG_DIR was not set.


2. Once I found the error logs, I found this -
[Sun Jan 26 06:25:04.325511 2014] [:warn] [pid 3472] mod_wsgi: 
Compiled for Python/2.7.5+.
[Sun Jan 26 06:25:04.325576 2014] [:warn] [pid 3472] mod_wsgi: Runtime 
using Python/2.7.6. 


I tried removing mod-python as recommended by the django docs, but 
that did not help. So I removed the Debian package for python-wsgi and 
compiled python-wsgi myself.


I am not at the point where I get Forbidden - You don have permission 
to access /mom/inventory on this server. This is progress!! ;)


I guess the current problem is that I cannot run the django app from a 
user account (/home/django/). I added the user django to the group 
www-data, but I still get the forbidden message. I will try moving it 
to /var/www as you have it set up.


Thanks again!

Mark

P.S. I got a good chuckle from your signature block - "Open Source: 
Without walls and fences, we need no Windows or Gates." A small nit, 
but I believe it should read ..., we need no Windows nor Gates... to 
be grammatically correct.



On Sun, Jan 26, 2014 at 7:43 PM, Fred Stluka > wrote:


Mark,

I'm doing this fine with Django 1.4.2 and Python 2.7.3.

My wsgi.py file looks like:


import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()



My Apache config looks like:



# WSGI setup, for use by Django and other Python webapps
# See notes in:
#  - http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
#  - http://code.google.com/p/modwsgi/wiki/ConfigurationIssues
#  -
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi
# --Fred 11/22/2012
WSGIPythonHome /var/python27/virtualenvs/hhl

Order allow,deny
Allow from all

WSGIDaemonProcess wsgi_apps processes=2 threads=15
display-name=%{GROUP}
WSGIProcessGroup  wsgi_apps
WSGIScriptAlias   /mypythonapp "/var/www/wsgi-bin/mypythonapp.wsgi"
WSGISocketPrefix  run/wsgi

#
# hhlweb Django app
#


Order deny,allow
Allow from all

WSGIDaemonProcess hhlweb processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup  hhlweb
# Note: Support both aliases for backward compatibility with
release 1.
WSGIScriptAlias /hhlweb /var/www/django/hhlweb/apache/django.wsgi
WSGIScriptAlias /   /var/www/django/hhlweb/apache/django.wsgi

# Map the Django STATIC_URL to the Django STATIC_ROOT


Order deny,allow
Allow from all

  

Re: failure of auto increment in inndb (mysql)

2014-01-27 Thread Erik Cederstrand
Den 27/01/2014 kl. 17.22 skrev Malik Rumi :

> I read this on the django project site: 
> Since MySQL 5.5.5, the default storage engine is InnoDB. This engine is fully 
> transactional and supports foreign key references. It's probably the best 
> choice at this point. However, note that the the InnoDB autoincrement counter 
> is lost on a MySQL restart because it does not remember the AUTO_INCREMENT 
> value, instead recreating it as "max(id)+1". This may result in an 
> inadvertent reuse of AutoField values.
> Now to my newby senses, this is a huge problem. How can you have a primary 
> key, or a foreign key, without the assurance that they are unique?

"reuse" does not imply "non-unique" in this situation - MySQL will still make 
sure that the ID field is unique. It just means that an ID you have previously 
deleted from the table may be reused. Consider this:

1) The last user you added was assigned ID 122
2) You add user "John Doe", MySQL assigns the value 123 to the ID field
3) You delete record with ID 123 again
4) MySQL reboots, resetting AUTO_INCREMENT to 122+1=123
5) You add user "Jane Smith", MySQL assigns the value 123 to the ID field

Now Jane Smith has the same ID as John Doe had previously. This may not be a 
problem in your situation, or it might. Anyway it's good practice to never 
re-purpose an ID.

Erik

-- 
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/3E44BD85-D6E6-41B1-9980-C5BA99B0C136%40cederstrand.dk.
For more options, visit https://groups.google.com/groups/opt_out.


Re: failure of auto increment in inndb (mysql)

2014-01-27 Thread Tom Lockhart
> ...
> Now Jane Smith has the same ID as John Doe had previously. This may not be a 
> problem in your situation, or it might. Anyway it's good practice to never 
> re-purpose an ID.

MySQL started as a non-ACID query server (not a full relational database in the 
accepted sense) and these kinds of issues likely stem from that history. Folks 
getting started with databases and django may want to consider using Postgres 
for their foundation.

hth

 - Tom

-- 
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/08011991-F07D-407A-B983-D7C694678631%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: failure of auto increment in inndb (mysql)

2014-01-27 Thread Javier Guerra Giraldez
On Mon, Jan 27, 2014 at 2:13 PM, Tom Lockhart  wrote:
> MySQL started as a non-ACID query server (not a full relational database in 
> the accepted sense) and these kinds of issues likely stem from that history. 
> Folks getting started with databases and django may want to consider using 
> Postgres for their foundation.


it's true that MySQL started as a very limited project and grew from
there, meaning that there are still several shortcomings when compared
with more complete and robust implementations, like Postgresql.

but this specific issue, isn't because of that history.  in fact, the
old MyISAM storage engine handles it differently: autoincrement fields
are monotonically incrementing.  (unless the storage gets corrupted).

it's the InnoDB implementation the one that didn't bother to handle
full monotonicity, considering the uniqueness and incrementing
conditions enough.

AFAIR, the SQL standard doesn't require full monotonicity... does it
even define autoincrement fields?  if there's no hard standard, i
don't think it could be considered a bug.

-- 
Javier

-- 
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/CAFkDaoQNwnC-3Ka3X1SS6%2Bk-%3DfMaxmj0DEKgV3QmMf4vkQQOyw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: failure of auto increment in inndb (mysql)

2014-01-27 Thread Erik Cederstrand
Den 27/01/2014 kl. 20.13 skrev Tom Lockhart :

>> ...
>> Now Jane Smith has the same ID as John Doe had previously. This may not be a 
>> problem in your situation, or it might. Anyway it's good practice to never 
>> re-purpose an ID.
> 
> MySQL started as a non-ACID query server (not a full relational database in 
> the accepted sense) and these kinds of issues likely stem from that history. 
> Folks getting started with databases and django may want to consider using 
> Postgres for their foundation.

Actually, auto_increment has nothing to do with ACID. MySQL just chooses to not 
store the nextval across reboots. You can set it manually with “ALTER TABLE Foo 
AUTO_INCREMENT=123”.

PostgreSQL creates a sequence as a separate single-row table to store the 
nextval so it is persistent across reboots, but you have to explicitly set the 
nextval if you e.g. bulk loading data into tables, which bypasses the sequence. 
If you don’t, inserts may fail because the sequence is creating duplicate keys.

MySQL goes the usual not-always-helpful route of guessing what you want 
(February 31st, anyone?). PostgreSQL has more control at the expense of 
foot-shooting.

Erik

-- 
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/166D1AF3-64B9-4360-8BE6-7BA98158F984%40cederstrand.dk.
For more options, visit https://groups.google.com/groups/opt_out.


Dyanmically changing Django Storage?

2014-01-27 Thread zweb

I am planning to use django-storages. It uses django settings, as

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'


I read it is bad practice to change django settings during runtime. I am 
not using Django's FileField.

During run time, based on file size and type,  I want to use a different 
storage backend. How to do it?

-- 
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/0bf2fa7b-d265-49d6-9694-edbb88b624e1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Dyanmically changing Django Storage?

2014-01-27 Thread Javier Guerra Giraldez
On Mon, Jan 27, 2014 at 3:07 PM, zweb  wrote:
> During run time, based on file size and type,  I want to use a different
> storage backend. How to do it?


write a storage backend proxy that picks which 'real' backend to use
for each file.

note that during upload, you have to start storing before knowing the
full size of the file.

-- 
Javier

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


Do you think Django's future is threatened by JS frameworks in both client & server?

2014-01-27 Thread damondeville
Hi,

I would like to know if this community is somewhat worried about the future 
relevance of Django (and other purely server-side MV* Python web app 
frameworks such as web2py for that matter) given the current momentum of 
JavaScript (JS) everywhere?

There are many competing architecture patterns for a WHOLE web app today 
ranging:
a)  from client-heavy SPA with a client-side MVC framework synching its 
models via a REST API with a server-side reduced to a database access layer

b) to light client apps with a server-side MVC frameworks and very little 
or no Ajax 

c) and everything in the middle.

I guess it is not too controversial to say that which is best (or even 
merely adequate) depends on the generally moving target of the app 
requirements (especially the non-functional ones) and thus a long lifecycle app 
can be expected to have to change pattern at some point.


Given that:
1) full web apps following any pattern can today be developed exclusively 
with JavaScript (JS) frameworks on both sides who have incorporated most 
(if not all) great design ideas from Django (and Rails)

2) IDEs ranging from Visual Studio to browser-based ones are available to 
support such development

3) Python in the browser projects do not yet provide productive debugging 
support (and will they ever without support from a tech giant?)

4) Cloud giants (Amazon, Google, Heroku, Microsoft) all offering JS framework 
running servers

are the productivity gains from the more legible, concise and abstract 
Python code as compared to JS code really compensate the productivity loss 
of having to port part of the app from one language to other every time it 
must be pushed from one side (say server) to the other (say client), or 
even to maintain a code base in two languages instead of one?

Why then adopt Django (or web2py) for a new project today, instead of going 
pure JS?

I am a big Python fan in terms of design and principles, but I am fearing 
that it has started to lose the popularity/adoption/community size battle 
against JS, which, from a pragmatic productivity standpoint is relevant and 
thus potentially snowballing after a tipping point is reached. Trends are 
deadly fast in web development, cf. how quickly J2EE+static HTML, then 
J2EE+Flash and .NET+Silverlight have fallen from grace.

Any thought on this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f01c1f78-aac4-467c-a777-a70ecd0de61e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Do you think Django's future is threatened by JS frameworks in both client & server?

2014-01-27 Thread Tim Chase
On 2014-01-27 14:44, damondevi...@gmail.com wrote:
> Why then adopt Django (or web2py) for a new project today, instead
> of going pure JS?
> 
> I am a big Python fan in terms of design and principles,

If you like JS as a language, then it makes sense to do everything in
JS.  However, I prefer Python by VAST measure over JS, so
will always prefer to do the majority of my server-side code in a
language that makes my life easier with things like iterators,
generators, real OOP, indentation-based blocks, and a standard
standard-library (with standard importing semantics).

-tkc




-- 
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/20140127175630.5310edba%40bigbox.christie.dr.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problems Setting Up wsgi and Apache

2014-01-27 Thread Mark Phillips
Fred,

My apologies if my comment about "or" and "nor" offended you. That was not
my intent.

Thanks,

Mark


On Mon, Jan 27, 2014 at 9:49 AM, Fred Stluka  wrote:

>  Mark,
>
> Most likely your Apache server is running as user "apache" in
> group "apache", and your Django code is being called by the
> Apache server via WSGI, so it is also running as user "apache".
>
> True?
>
> If so, make sure that the files and directories needed by the
> Apache and Django code are all accessible to user "apache".
>
> P.S.  "or" vs "nor" -- Yeah, I have a VERY strong background in
> English grammar.  Partly because it was beaten into me by
> the nuns, and party because I'm such a fundamentally nerdy
> engineer type that I found the technique of "diagramming a
> sentence" to be fascinating and even fun.
>
> So, I know the difference between an adjective and an adverb,
> can cite things like the "present perfect tense", know what a
> "dangling participle" is and that you are not supposed to end
> a sentence with a preposition, etc.
>
> But, the vast majority of people I meet seem to agree  with
> Churchill that such rules are things "up with which we shall
> not put" [1], so I rarely correct anyone any more, and have
> come to recognize that language is a living evolving thing.
> The most common usage is by definition the correct usage,
> despite what it says in the Oxford English Dictionary (six
> inches thick), "Warriner's English Grammar and Composition",
> or the "MLA Handbook" -- all sitting within reach of me
> right now).
>
> [1] http://public.wsu.edu/~brians/errors/churchill.html
>
> In fact, I pretty much avoid ever using "nor" or "whom"
> because people notice when I do, and change their opinion
> of me slightly away from hard-hitting, down-to-earth
> engineer, and towards ivory tower academic.
>
> Also, I decided many years ago to never use a full sentence
> when a simple phrase will do.
>
> Anyhow, good luck with your Django/WSGI setup!
>
> Any more problems, speak up.
>
>
> --Fred
> --
> Fred Stluka -- mailto:f...@bristle.com  --
> http://bristle.com/~fred/
> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
> Open Source: Without walls and fences, we need no Windows or Gates.
> --
>
> On 1/27/14 11:01 AM, Mark Phillips wrote:
>
> Fred,
>
>  Thanks for your help. I made some progress so far.
>
>  1. I discovered that I fogot to add the port 7000 to Apache´s ports.conf.
>
>  2. The Apache error logs were in /var/log/apache2/error.log and not in
> /var/log/apache2/mom/error.log. APACHE_LOG_DIR was not set.
>
>  2. Once I found the error logs, I found this -
>
> [Sun Jan 26 06:25:04.325511 2014] [:warn] [pid 3472] mod_wsgi: Compiled
> for Python/2.7.5+.
> [Sun Jan 26 06:25:04.325576 2014] [:warn] [pid 3472] mod_wsgi: Runtime
> using Python/2.7.6.
>
>  I tried removing mod-python as recommended by the django docs, but that
> did not help. So I removed the Debian package for python-wsgi and compiled
> python-wsgi myself.
>
>  I am not at the point where I get Forbidden - You don have permission to
> access /mom/inventory on this server. This is progress!! ;)
>
>  I guess the current problem is that I cannot run the django app from a
> user account (/home/django/). I added the user django to the group
> www-data, but I still get the forbidden message. I will try moving it to
> /var/www as you have it set up.
>
>  Thanks again!
>
>  Mark
>
>  P.S. I got a good chuckle from your signature block - "Open Source:
> Without walls and fences, we need no Windows or Gates." A small nit, but I
> believe it should read ..., we need no Windows nor Gates... to be
> grammatically correct.
>
>
> On Sun, Jan 26, 2014 at 7:43 PM, Fred Stluka  wrote:
>
>>  Mark,
>>
>> I'm doing this fine with Django 1.4.2 and Python 2.7.3.
>>
>> My wsgi.py file looks like:
>>
>>
>> import django.core.handlers.wsgi
>>
>> application = django.core.handlers.wsgi.WSGIHandler()
>>
>>
>>
>> My Apache config looks like:
>>
>>
>>
>> # WSGI setup, for use by Django and other Python webapps
>> # See notes in:
>> #  - http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
>> #  - http://code.google.com/p/modwsgi/wiki/ConfigurationIssues
>> #  - https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi
>> # --Fred 11/22/2012
>> WSGIPythonHome /var/python27/virtualenvs/hhl
>> 
>> Order allow,deny
>> Allow from all
>> 
>> WSGIDaemonProcess wsgi_apps processes=2 threads=15 display-name=%{GROUP}
>> WSGIProcessGroup  wsgi_apps
>> WSGIScriptAlias   /mypythonapp "/var/www/wsgi-bin/mypythonapp.wsgi"
>> WSGISocketPrefix  run/wsgi
>>
>> #
>> # hhlweb Django app
>> #
>> 
>>
>> Order deny,allow
>> Allow from all
>> 
>>  WSGIDaemonProcess hhlweb processes=2 threads=15 display-name=%{GROUP}
>> WSGIProcessGroup  hhlweb
>> # Note: Support both aliases for backward compatibility with release 1.
>> WSGIScriptAlias /hhlweb /var/www/django/hhlweb/apache/django.wsgi
>> WSGISc

Need help with pushing technology ... and a bit more ...

2014-01-27 Thread Mario R. Osorio
Background:
===
We are studying the possibility of creating a system that will have the 
following entities:
Customer(s) (appCustomer)
Service Provider(s) (appProviders) and
Manager(s)
Server(s)

appCustomers will have all appServices available to them and appServices 
will have at least one appManager and zero to many appServers.

Each one of these entities will run an application on android, ios and 
windoze phone at least, as well as (hopefully) linux, osx and windoze 
(these last three are needed for appManagers)

An appCustomer will use either an application or a given web site to 
request services via HTTP from the available appProviders.

Our system should immediately upon receiving this order, notify all 
involved appManagers and appServers, report back to appCustomer  who got 
notified of his/her request.

appManagers and appServers will interact with the system via applications 
in order to notify appCustomer/appManager(s) of any progress in serving the 
appService, until its completion.

All notification must be logged so that anyone involved in a given 
appService can check all activity and, for example, to allow appManagers to 
supervise the completion of a given appService request.

Reading the previous explanation I notice this is pretty much your common 
“Purchase Order System” except we need real time, bullet proof 
communications between all players, along with the possibility of SMS and 
mail capabilities as well as logs for all communication media.

Our system is to go live immediately with one (paying) customer 
representing around 100 appCustomers. We are expecting the live system to 
produce anywhere between 500 to 2000 notifications per day which is not a 
lot but (expected) growth will be exponential and might reach about a 
million notifications in about a year or two.

Observations:
=
I'd like to keep this project python/C/C++ only, or at least as much as 
possible.
I'm not a seasoned python/C/C++ programmer though; but I'm in l.o.v.e. with 
python and C and C++.
I understand even less about communications and I know I have to use some 
way to push all notifications, but I have not been able to find a solution 
that will work on all needed platforms (android, ios, windows phone, linux, 
osx and windows). I wouldn't mind using two or three different push 
technologies if that was the case but: 

Questions:
==
Isn't there a better way to push notifications?
Do I forcibly have to use a service such as “Urban Airship”, “Pushwoosh”, 
“Amazon SNS”, “Windows Azure Notification Hubs”, “Pushover”, “Prowl” or 
“Notify My Android”??
Would it be possible to build our own push service by using a combination 
of telnet, xmlrpc, websockets or xmpp along with twisted, tornado or 
gevent; living along with django and possible mezzanine in my “perfect 
python world”?
Am I asking too much or am I so lost I don't even make sense?

I've been reading about all these topics/products in the las couple of days 
and every line I read seems to get me the more confused...

When I was initially involved in this idea I thought it was all about 
finding a nice library for a good *real time communications protocol 
* but, as 
I said before; I know nothing about communications and in spite of all the 
good intentions of those answering that post; I am yet to make sense of 
everything.

I do not ask for a solution to my situation but at least some light as to 
what might be a good path to follow … I will make sure you confess a 
solution once I figure out what are you talking about :)

I will really appreciate and and all comments, ideas and recommendations … 
even epithets!

Thanks a lot in advanced!
Mario R. Osorio

-- 
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/211c15a3-2036-44e8-9fb5-02be6a5d0bea%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Do you think Django's future is threatened by JS frameworks in both client & server?

2014-01-27 Thread Brad Moore
The tech giants are pushing JavaScript more than Python these days. 
 JavaScript is said to be the future language for enterprise applications. 
I think Python will be around but will play a third place role behind 
JavaScript and PHP. Yes, I said PHP and I apologize but its true just look 
at the cloud support that is quietly being offered for PHP. I have used PHP 
extensively and it can be very good and very bad depending on the 
developer. .NET is terrible I almost quit an IT career before it started 
because we were forced to use Visual Studio and Microsoft technologies for 
web development in college. My opinion as long as good design principles 
are followed using an MVC approach all three are good choices. Python is 
not going to go away because it is being used to teach the next generation 
of computer scientists throughout the world. Get used to { } all over the 
place or just stick with Python and Django it will not matter.  

On Monday, January 27, 2014 5:44:12 PM UTC-5, damond...@gmail.com wrote:
>
> Hi,
>
> I would like to know if this community is somewhat worried about the 
> future relevance of Django (and other purely server-side MV* Python web 
> app frameworks such as web2py for that matter) given the current momentum 
> of JavaScript (JS) everywhere?
>
> There are many competing architecture patterns for a WHOLE web app today 
> ranging:
> a)  from client-heavy SPA with a client-side MVC framework synching its 
> models via a REST API with a server-side reduced to a database access layer
>
> b) to light client apps with a server-side MVC frameworks and very little 
> or no Ajax 
>
> c) and everything in the middle.
>
> I guess it is not too controversial to say that which is best (or even 
> merely adequate) depends on the generally moving target of the app 
> requirements (especially the non-functional ones) and thus a long 
> lifecycle app can be expected to have to change pattern at some point.
>
>
> Given that:
> 1) full web apps following any pattern can today be developed exclusively 
> with JavaScript (JS) frameworks on both sides who have incorporated most 
> (if not all) great design ideas from Django (and Rails)
>
> 2) IDEs ranging from Visual Studio to browser-based ones are available to 
> support such development
>
> 3) Python in the browser projects do not yet provide productive debugging 
> support (and will they ever without support from a tech giant?)
>
> 4) Cloud giants (Amazon, Google, Heroku, Microsoft) all offering JS framework 
> running servers
>
> are the productivity gains from the more legible, concise and abstract 
> Python code as compared to JS code really compensate the productivity 
> loss of having to port part of the app from one language to other every 
> time it must be pushed from one side (say server) to the other (say 
> client), or even to maintain a code base in two languages instead of one?
>
> Why then adopt Django (or web2py) for a new project today, instead of 
> going pure JS?
>
> I am a big Python fan in terms of design and principles, but I am fearing 
> that it has started to lose the popularity/adoption/community size battle 
> against JS, which, from a pragmatic productivity standpoint is relevant 
> and thus potentially snowballing after a tipping point is reached. Trends 
> are deadly fast in web development, cf. how quickly J2EE+static HTML, then 
> J2EE+Flash and .NET+Silverlight have fallen from grace.
>
> Any thought on this?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/02a3d0f6-2304-422e-acc5-083d4af7d219%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Need Help Moving Database to production server

2014-01-27 Thread Mark Phillips
I have a django project running on my laptop. I have (finally) managed to
get it to work with apache on a production server. However, I still have a
problem. When I access the admin site and login as the superuser, I get
"you don't have permission to do anything" message.

To migrate the database, I did a mysqldump to a file on the development
machine, then added it to the mysql server running on the production
machine. The only change was in the database name, none of the tables
changed. Is this the problem? Or, am I missing something else.

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


Re: Need Help Moving Database to production server

2014-01-27 Thread Mike Dewhirst

On 28/01/2014 4:51pm, Mark Phillips wrote:

I have a django project running on my laptop. I have (finally) managed
to get it to work with apache on a production server. However, I still
have a problem. When I access the admin site and login as the superuser,
I get "you don't have permission to do anything" message.


I don't think this is a Django problem because the superuser doesn't 
need any permissions. Presumably this is after a successful login - you 
don't quite specify this.




To migrate the database, I did a mysqldump to a file on the development
machine, then added it to the mysql server running on the production
machine. The only change was in the database name, none of the tables
changed. Is this the problem? Or, am I missing something else.


Did you also change the database name in your production settings.py?

Otherwise, I'd suspect a mismatch somewhere. For my own setups I always 
have the same user as the the database owner in Postgres and the 
superuser in Django. Dunno whether that has shielded me from this sort 
of problem or not.


hth

Mike



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/CAEqej2NgioCC8csFPhJonZtnHL7bzbdLMYaQtzPwCVcY_0fumQ%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/52E7535D.7030400%40dewhirst.com.au.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Do you think Django's future is threatened by JS frameworks in both client & server?

2014-01-27 Thread Avraham Serour
you will eventually need to keep a couple of different codebases in some
different languges.
Say you get popular enough and now you need to launch a desktop app,
android and iphone.
Take dropbox for example, they have a web version, desktop, android and
iphone (did I miss any platform?)
For desktop you can still use python and I don't think it is possible to
make a desktop application with js.
For android you'll need to use java and eventually you might use C++
For iphone you're stuck with objective-c (which I hate it more than js btw)
For mobile you could still use something like phonegap if you really love
js.

Django always took an agnostic approach to client side, in my opinion this
needs to change so not to risk becoming obsolete, but no need to rush.

And as you said these trends come and go fast, server side js is trendy
right now and is relatively new, maybe it will stick around and maybe it
will go away, python is getting popular but is not so trendy, I believe is
has a more solid base.

Also I don't believe you need to be in such a hurry to jump on the server
js train, this is new, meaning there are still few libraries around, and
honestly I would first check the quality of the code of the libraries and
frameworks, as php js has a low entry level, many people without much idea
on what's going on are writing libs and releasing, this is good, people are
learning, but be careful before using any code you see on the internet,
I've seen too many spaghetti code and hacks in popular php frameworks.

best regards
Avraham



On Tue, Jan 28, 2014 at 5:59 AM, Brad Moore wrote:

> The tech giants are pushing JavaScript more than Python these days.
>  JavaScript is said to be the future language for enterprise applications.
> I think Python will be around but will play a third place role behind
> JavaScript and PHP. Yes, I said PHP and I apologize but its true just look
> at the cloud support that is quietly being offered for PHP. I have used PHP
> extensively and it can be very good and very bad depending on the
> developer. .NET is terrible I almost quit an IT career before it started
> because we were forced to use Visual Studio and Microsoft technologies for
> web development in college. My opinion as long as good design principles
> are followed using an MVC approach all three are good choices. Python is
> not going to go away because it is being used to teach the next generation
> of computer scientists throughout the world. Get used to { } all over the
> place or just stick with Python and Django it will not matter.
>
>
> On Monday, January 27, 2014 5:44:12 PM UTC-5, damond...@gmail.com wrote:
>>
>> Hi,
>>
>> I would like to know if this community is somewhat worried about the
>> future relevance of Django (and other purely server-side MV* Python web
>> app frameworks such as web2py for that matter) given the current momentum
>> of JavaScript (JS) everywhere?
>>
>> There are many competing architecture patterns for a WHOLE web app today
>> ranging:
>> a)  from client-heavy SPA with a client-side MVC framework synching its
>> models via a REST API with a server-side reduced to a database access layer
>>
>> b) to light client apps with a server-side MVC frameworks and very
>> little or no Ajax
>>
>> c) and everything in the middle.
>>
>> I guess it is not too controversial to say that which is best (or even
>> merely adequate) depends on the generally moving target of the app
>> requirements (especially the non-functional ones) and thus a long
>> lifecycle app can be expected to have to change pattern at some point.
>>
>>
>> Given that:
>> 1) full web apps following any pattern can today be developed exclusively
>> with JavaScript (JS) frameworks on both sides who have incorporated most
>> (if not all) great design ideas from Django (and Rails)
>>
>> 2) IDEs ranging from Visual Studio to browser-based ones are available
>> to support such development
>>
>> 3) Python in the browser projects do not yet provide productive debugging
>> support (and will they ever without support from a tech giant?)
>>
>> 4) Cloud giants (Amazon, Google, Heroku, Microsoft) all offering JS framework
>> running servers
>>
>> are the productivity gains from the more legible, concise and abstract
>> Python code as compared to JS code really compensate the productivity
>> loss of having to port part of the app from one language to other every
>> time it must be pushed from one side (say server) to the other (say
>> client), or even to maintain a code base in two languages instead of one?
>>
>> Why then adopt Django (or web2py) for a new project today, instead of
>> going pure JS?
>>
>> I am a big Python fan in terms of design and principles, but I am fearing
>> that it has started to lose the popularity/adoption/community size battle
>> against JS, which, from a pragmatic productivity standpoint is relevant
>> and thus potentially snowballing after a tipping point is reached. Trends
>> are deadly fast in web development, cf. how q

Re: Do you think Django's future is threatened by JS frameworks in both client & server?

2014-01-27 Thread Chris Hinds
Coffeescript.org makes some of those things better, but it's no Python. 

C. 

> On 27 Jan 2014, at 23:57, "Tim Chase"  wrote:
> 
>> On 2014-01-27 14:44, damondevi...@gmail.com wrote:
>> Why then adopt Django (or web2py) for a new project today, instead
>> of going pure JS?
>> 
>> I am a big Python fan in terms of design and principles,
> 
> If you like JS as a language, then it makes sense to do everything in
> JS.  However, I prefer Python by VAST measure over JS, so
> will always prefer to do the majority of my server-side code in a
> language that makes my life easier with things like iterators,
> generators, real OOP, indentation-based blocks, and a standard
> standard-library (with standard importing semantics).
> 
> -tkc
> 
> 
> 
> 
> -- 
> 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/20140127175630.5310edba%40bigbox.christie.dr.
> 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/15FB8473-05AC-4593-99AE-FFB380460669%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Dyanmically changing Django Storage?

2014-01-27 Thread Avraham Serour
you can define the storage for each FileField when declaring your model, it
will use the default unless you specify something else.
Does your use case have the same model using different storages?
I suggest you make different models, each using the storage you want,
Lets say you have two models, S3File and LocalFile
when uploading the file you then decide if it is a S3File object or a
LocalFile object


On Mon, Jan 27, 2014 at 10:19 PM, Javier Guerra Giraldez  wrote:

> On Mon, Jan 27, 2014 at 3:07 PM, zweb  wrote:
> > During run time, based on file size and type,  I want to use a different
> > storage backend. How to do it?
>
>
> write a storage backend proxy that picks which 'real' backend to use
> for each file.
>
> note that during upload, you have to start storing before knowing the
> full size of the file.
>
> --
> Javier
>
> --
> 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/CAFkDaoRxkzGb1z3uLt%2B6WzFoKpgq6F05c7xdH9cqqLMhfHof8w%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/CAFWa6tLouA62Qb9_NPf%2BjU%2B-Cb-zVb1x2y9XBaQ98rnZ9f9FGg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Need help with pushing technology ... and a bit more ...

2014-01-27 Thread Avraham Serour
> Isn't there a better way to push notifications?
Better than what?
> Do I forcibly have to use a service...
no, but it will make your life easier
> Would it be possible to build our own push service ...
yes, why not

I suggest not making your life too complicated, make the system as simple
as possible then introduce features in different releases. for example
don't implement push notifications yet, leave it for version 2


On Tue, Jan 28, 2014 at 5:44 AM, Mario R. Osorio wrote:

> Background:
> ===
> We are studying the possibility of creating a system that will have the
> following entities:
> Customer(s) (appCustomer)
> Service Provider(s) (appProviders) and
> Manager(s)
> Server(s)
>
> appCustomers will have all appServices available to them and appServices
> will have at least one appManager and zero to many appServers.
>
> Each one of these entities will run an application on android, ios and
> windoze phone at least, as well as (hopefully) linux, osx and windoze
> (these last three are needed for appManagers)
>
> An appCustomer will use either an application or a given web site to
> request services via HTTP from the available appProviders.
>
> Our system should immediately upon receiving this order, notify all
> involved appManagers and appServers, report back to appCustomer  who got
> notified of his/her request.
>
> appManagers and appServers will interact with the system via applications
> in order to notify appCustomer/appManager(s) of any progress in serving the
> appService, until its completion.
>
> All notification must be logged so that anyone involved in a given
> appService can check all activity and, for example, to allow appManagers to
> supervise the completion of a given appService request.
>
> Reading the previous explanation I notice this is pretty much your common
> “Purchase Order System” except we need real time, bullet proof
> communications between all players, along with the possibility of SMS and
> mail capabilities as well as logs for all communication media.
>
> Our system is to go live immediately with one (paying) customer
> representing around 100 appCustomers. We are expecting the live system to
> produce anywhere between 500 to 2000 notifications per day which is not a
> lot but (expected) growth will be exponential and might reach about a
> million notifications in about a year or two.
>
> Observations:
> =
> I'd like to keep this project python/C/C++ only, or at least as much as
> possible.
> I'm not a seasoned python/C/C++ programmer though; but I'm in l.o.v.e.
> with python and C and C++.
> I understand even less about communications and I know I have to use some
> way to push all notifications, but I have not been able to find a solution
> that will work on all needed platforms (android, ios, windows phone, linux,
> osx and windows). I wouldn't mind using two or three different push
> technologies if that was the case but:
>
> Questions:
> ==
> Isn't there a better way to push notifications?
> Do I forcibly have to use a service such as “Urban Airship”, “Pushwoosh”,
> “Amazon SNS”, “Windows Azure Notification Hubs”, “Pushover”, “Prowl” or
> “Notify My Android”??
> Would it be possible to build our own push service by using a combination
> of telnet, xmlrpc, websockets or xmpp along with twisted, tornado or
> gevent; living along with django and possible mezzanine in my “perfect
> python world”?
> Am I asking too much or am I so lost I don't even make sense?
>
> I've been reading about all these topics/products in the las couple of
> days and every line I read seems to get me the more confused...
>
> When I was initially involved in this idea I thought it was all about
> finding a nice library for a good *real time communications protocol
> * but,
> as I said before; I know nothing about communications and in spite of all
> the good intentions of those answering that post; I am yet to make sense of
> everything.
>
> I do not ask for a solution to my situation but at least some light as to
> what might be a good path to follow … I will make sure you confess a
> solution once I figure out what are you talking about :)
>
> I will really appreciate and and all comments, ideas and recommendations …
> even epithets!
>
> Thanks a lot in advanced!
> Mario R. Osorio
>
>  --
> 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/211c15a3-2036-44e8-9fb5-02be6a5d0bea%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this messag