Connection retry parameter

2020-11-19 Thread Stefano Tranquillini

Hello all,
i run into this package https://github.com/jdelic/django-dbconn-retry and I 
was wondering why is not django doing it by itself?
It has timeout and other parameters, why not also a retry parameter 
(default 0)?
is there any drawback?

PS: has anyone used that package and confirms that it's the right way 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7a426675-295c-45ba-87f2-5bbab51eb49bn%40googlegroups.com.


Re: username and allowed alphanumeric, why?

2018-04-12 Thread Stefano Tranquillini
My question was related why only that set of extrachars, adding a '=' is a 
dangerous step or not?
Reading the rest of the page it seems that everyhing is supported with 
unicode.

On Wednesday, April 11, 2018 at 4:03:04 PM UTC+2, Melvyn Sopacua wrote:
>
> On dinsdag 10 april 2018 11:10:33 CEST Stefano Tranquillini wrote: 
>
> > mostly curiosity, why does the username 
> > 
> https://docs.djangoproject.com/en/1.11/ref/contrib/auth/#django.contrib.auth 
> > .models.User.username allow only _, @, +, . and - characters? 
> > is there a reason for that? 
>
> Yeah. It's explained a few lines below in the box titled "Usernames and 
> unicode". The special chars mentioned are just as random I presume. 
>
>
> -- 
> Melvyn Sopacua 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/35193314-5e2f-4172-98c3-ec83dfe872ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


username and allowed alphanumeric, why?

2018-04-10 Thread Stefano Tranquillini
Hi all,

mostly curiosity, why does the username 
https://docs.djangoproject.com/en/1.11/ref/contrib/auth/#django.contrib.auth.models.User.username
 
allow only _, @, +, . and - characters?
is there a reason for that? 


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/62ca69fe-ca26-4b48-ac19-4f4887dce08a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: widget rendering custom html

2018-04-06 Thread Stefano Tranquillini
The problem was that I've used cispy-form and apparently they don't work as 
expected.

PS: i wrote a post about how I modified the widget and the rest to make it 
look different, 
https://stefanotranquillini.wordpress.com/2018/04/03/beautiful-django-widget-for-multi-selection/

On Tuesday, March 27, 2018 at 10:31:46 AM UTC+2, Stefano Tranquillini wrote:
>
> Hi all,
>
> I would like to personlize a widget adding an extra link. In particular I 
> want to change the forms.widgets.CheckboxSelectMultiple .
> I've read this: https://docs.djangoproject.com/en/2.0/ref/forms/renderers/  
> but I can't still make it working, I did this piece of code
>
> class MultiChoiceFilterWidget(forms.widgets.CheckboxSelectMultiple):
>  template_name = 'web_admin/partial/checkbox.html'
>
> class PurposesChoiceForm(ModelForm):
>
> class Meta:
>  model = MyModel
>  fields = ('myField',)
>  widgets = {
>  'myField': forms.widgets.CheckboxSelectMultiple,
>  }
>
>
> (indented correctly)
>
> However, there's no way to make it running, what else should I do?
>
> I also tried to put the .html directly inside my app template folder such 
> as web/template/django/forms/widget/checkbox.html but with no luck.
>
> does anyone can point me to a working example or tutorial?
>
> do I've to setup the TemplatesSetting or is there another way to do it?
>
>
> PS: i would like to personlize the widget just for this form, and not for 
> all the forms.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/990f1253-4a35-4b2f-846d-c56b76aa9a55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


widget rendering custom html

2018-03-27 Thread Stefano Tranquillini
Hi all,

I would like to personlize a widget adding an extra link. In particular I 
want to change the forms.widgets.CheckboxSelectMultiple .
I've read this: https://docs.djangoproject.com/en/2.0/ref/forms/renderers/  
but I can't still make it working, I did this piece of code

class MultiChoiceFilterWidget(forms.widgets.CheckboxSelectMultiple):
 template_name = 'web_admin/partial/checkbox.html'

class PurposesChoiceForm(ModelForm):

class Meta:
 model = MyModel
 fields = ('myField',)
 widgets = {
 'myField': forms.widgets.CheckboxSelectMultiple,
 }


(indented correctly)

However, there's no way to make it running, what else should I do?

I also tried to put the .html directly inside my app template folder such 
as web/template/django/forms/widget/checkbox.html but with no luck.

does anyone can point me to a working example or tutorial?

do I've to setup the TemplatesSetting or is there another way to do it?


PS: i would like to personlize the widget just for this form, and not for 
all the forms.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2bbc0c16-057f-4a69-a3ac-397f605ee302%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Rename Table limiting the down of the system

2017-03-15 Thread Stefano Tranquillini
Thanks,
On Wed, Mar 15, 2017 at 9:43 AM, Mike Dewhirst <mi...@dewhirst.com.au>
wrote:

> On 15/03/2017 7:12 PM, Stefano Tranquillini wrote:
>
>> Hi people.
>>
>> I've to do a migration for the database, specifically I've to rename a
>> table.
>>
>> To do so I've a RunPython that runs this sql statemnet
>> `ALTER TABLE "old_table" RENAME TO "new_table"`
>> First question: should I use https://docs.djangoproject.com
>> /en/1.8/ref/migration-operations/#renamemodel , does it do the same?
>>
>
> I believe it does the same ... certainly worked for me with Postgres. Make
> an empty migration.
>
> operations = [
>
> migrations.RenameModel('Oldname', 'Newname'),
>
> migrations.AlterModelTable('Newname', 'appname_newname'),
>
> ]
>
>
​the fact is that when i do renameModel it tells me that "No installed app
with label.." but if run the sql statment as above it works.
in your operations there is also the alter model, why so?​



>
> Will these operation update all the refrences in the code, such that
>> django will keep working without problems?
>>
>
> Definitely not.
>
>
​I probably asked the worng question. I was trying to infeer if references
in the DB will be updated as well.​



-- 
Stefano

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPQ1%3DkCRp5XFGzRmCUE7H1Hq%3DPD1_MAkw3kND%2BXD-m0%2BexDL-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Rename Table limiting the down of the system

2017-03-15 Thread Stefano Tranquillini
Hi people.

I've to do a migration for the database, specifically I've to rename a 
table.

To do so I've a RunPython that runs this sql statemnet 
`ALTER TABLE "old_table" RENAME TO "new_table"`
First question: should I use 
https://docs.djangoproject.com/en/1.8/ref/migration-operations/#renamemodel 
, does it do the same?
Will these operation update all the refrences in the code, such that django 
will keep working without problems?

Now, I'm using postgres and I've two servers using the same DB, let's call 
them A and B.  when I'll rename the table the code will break, so the 
procedure will be:

- stop A
- update A
- migrate
- stop B
- start A

The problem is, that I've to be sure that migrations are atomic and have a 
transaction that locks the DB (or that table). Reading the documentation I 
found:
*On databases that do support DDL transactions (SQLite and PostgreSQL), 
RunPython operations do not have any transactions automatically added 
besides the transactions created for each migration.* - 
https://docs.djangoproject.com/en/1.10/ref/migration-operations/ (I'm using 
1.8)
If i go with renameModel, will it be in a single transaction?

What I want to avoid is to stop both A and B to perform migrations. 
It would be better to do the migration and then stop B, this should have a 
down that is smaller compared to stopping all services and the run them 
again.

any suggestion?

Ciao


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3205d24d-537b-4819-b2e4-e1adc31a3d46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


StreamingHttpResponse response length in a stats middleware

2017-01-18 Thread Stefano Tranquillini
Hi there,

I'm using the StreamingHttpResponse to stream a response, it works great. 
Now, I've a middleware that measures the size of req/response that users 
do. 
For normal HttpResponse i use len(response.content) [i know that it does 
not give the bytes, but it's pretty close], for the streaming I can't, and 
I can't use the streaming_content as well.

the docs says ` Because the content can’t be accessed, many middlewares 
can’t function normally.` 
Thus, is there a way to get the length of the response for a 
StreamingHttpResponse?

If I would be able to know the size of the response at some point in time 
(it's an iterator, so i just need to count) and i could put it in the 
request object, how can I make it working with the middleware? beacuse the 
process_response is fired just after the first yield, no?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f6a89f2a-8f1e-4fd9-8d21-88244251699a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sharding DB: one database per user dynamically

2016-10-06 Thread Stefano Tranquillini
Well, not really.

I would like to shard the db, but probably i can just build a function to
write on DB1 or DB2   depending on the user id, this should be feasible,
isn't it?

then i'll check how to export based on user_id. that's a nice idea, i just
have to figure out how to do with all the references among tables.

On Thu, Oct 6, 2016 at 10:45 AM, Erik Cederstrand <erik+li...@cederstrand.dk
> wrote:

>
> > Den 6. okt. 2016 kl. 09.54 skrev Stefano Tranquillini <
> stefano.tranquill...@gmail.com>:
> >
> > Hi all,
> >
> > I quickly skimmed into the group but i did not find an updated answer.
> >
> > what i want to do is to have a database for each user that register to
> my service, the structure of the databse is the same for all, the data are
> just separated.
> > I want to do this for two reasons:
> > - be able to move database of users from place to place
> > - be able to dump and restore single user databases
>
> While your proposal is probably feasible, I would expect heavier arguments
> than the above to accept the added complexity and possible fighting with
> Django the get it to work.
>
> Unless you have clear technical or legal requirements that dictate
> separate databases, just write export and import scripts that know to do
> "WHERE user_id = XXX" on the relevant tables.
>
> Erik
>
>
> --
> 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/PZmuOiZ06vI/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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/5FDDA79F-D343-4B8E-A0A4-514B6E75115D%40cederstrand.dk.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Stefano

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPQ1%3DkCvJUn50ZKXRhefC%2BJJiV3YOLwasO_jhjVDn-E24bcAvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Sharding DB: one database per user dynamically

2016-10-06 Thread Stefano Tranquillini
Hi all,

I quickly skimmed into the group but i did not find an updated answer. 

what i want to do is to have a database for each user that register to my 
service, the structure of the databse is the same for all, the data are 
just separated.
I want to do this for two reasons:
- be able to move database of users from place to place
- be able to dump and restore single user databases

As far as i understood, the connection settings could allow this, but it 
must be dynamic and not bind to the setting, basically the flow should be:

- user register (still haven't decided if users registered all falls in the 
same database, probably easier)
- i create a database within postgres, maybe using his id/pk/clientId (like 
if i set the "name" in the database setting), something like a syncdb where 
db name is the user id
- all the query data of that user are routed to his db
- (next step is to separate each of these database to diffrente postgres 
machines, but from time being it's all in one machine)
 
is this even possible? is it out of mind/dangerous to do?


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/39aa5b0e-631c-44f0-8b95-f70ae6566339%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django.core.exceptions.FieldDoesNotExist but the field exists

2016-09-07 Thread Stefano Tranquillini
It seems that i missed a part while merging.

On Mon, Sep 5, 2016 at 5:55 PM, Michal Petrucha <
michal.petru...@konk.org> wrote:

> On Mon, Sep 05, 2016 at 08:44:55AM -0700, Stefano Tranquillini wrote:
> > Hello
> >
> > I've a problem syncing the db.
> >
> > I run the command: django-admin migrate
> >
> > System check identified some issues:
> > Operations to perform:
> >   Synchronize unmigrated apps: oauth2_provider, 
> >   Apply all migrations: admin, Synchronizing apps without
> migrations:
> >   Creating tables...
> > Running deferred SQL...
> >   Installing custom SQL...Running migrations:
> >   No migrations to apply.Traceback (most recent call last):
> >   File "/Users/stefano/.virtualenvs/prjrest/bin/django-admin", line 11,
> in 
> > sys.exit(execute_from_command_line())
> >   File "/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-
> packages/django/core/management/__init__.py", line 354, in
> execute_from_command_line
> > utility.execute()
> >   File "/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-
> packages/django/core/management/__init__.py", line 346, in execute
> > self.fetch_command(subcommand).run_from_argv(self.argv)
> >   File "/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-
> packages/django/core/management/base.py", line 394, in run_from_argv
> > self.execute(*args, **cmd_options)
> >   File "/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-
> packages/django/core/management/base.py", line 445, in execute
> > output = self.handle(*args, **options)
> >   File "/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-
> packages/django/core/management/commands/migrate.py", line 208, in handle
> > changes = autodetector.changes(graph=executor.loader.graph)
> >   File "/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-
> packages/django/db/migrations/autodetector.py", line 43, in changes
> > changes = self._detect_changes(convert_apps, graph)
> >   File "/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-
> packages/django/db/migrations/autodetector.py", line 165, in
> _detect_changes
> > old_field = self.old_apps.get_model(app_label,
> old_model_name)._meta.get_field(field_name)
> >   File "/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-
> packages/django/db/models/options.py", line 554, in get_field
> > raise FieldDoesNotExist('%s has no field named %r' %
> (self.object_name, field_name))
> > django.core.exceptions.FieldDoesNotExist: CustomerKey has no field
> named u'customer_key_cipher_text'
> >
> > So, it seems that there are not migration, but still django complains
> for a
> > missing field.
> >
> > However in the model the field is there
> >
> >
> > class CustomerKey(models.Model):...
> > customer_key_cipher_text = Base64Field(default='')
> >
> > Any idea on what's the problem?
>
> According to the stack trace, this error happens when the autodetector
> is trying to get the model field from a previous state of the models,
> which is determined from the migration history, not the current model
> definitions.
>
> Have you by any chance made any changes to any of the existing
> migrations? I can imagine that this could happen if one of your
> migrations tries to make an AlterField operation on a field that
> hasn't been created in any of the preceding migrations.
>
> Good luck,
>
> Michal
>
> --
> 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/DFXLEJsIJUo/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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/20160905155543.GJ6601%40konk.org.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Stefano

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPQ1%3DkBPen0Xu94GenX%3DJEAS%2BAMe3bb-%3DPJ2cRs%3DUsHqrb_4GQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django.core.exceptions.FieldDoesNotExist but the field exists

2016-09-05 Thread Stefano Tranquillini
Hello

I've a problem syncing the db.

I run the command: django-admin migrate

System check identified some issues:
Operations to perform:
  Synchronize unmigrated apps: oauth2_provider, 
  Apply all migrations: admin, Synchronizing apps without 
migrations:
  Creating tables...
Running deferred SQL...
  Installing custom SQL...Running migrations:
  No migrations to apply.Traceback (most recent call last):
  File "/Users/stefano/.virtualenvs/prjrest/bin/django-admin", line 11, in 

sys.exit(execute_from_command_line())
  File 
"/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-packages/django/core/management/__init__.py",
 line 354, in execute_from_command_line
utility.execute()
  File 
"/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-packages/django/core/management/__init__.py",
 line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-packages/django/core/management/base.py",
 line 394, in run_from_argv
self.execute(*args, **cmd_options)
  File 
"/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-packages/django/core/management/base.py",
 line 445, in execute
output = self.handle(*args, **options)
  File 
"/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
 line 208, in handle
changes = autodetector.changes(graph=executor.loader.graph)
  File 
"/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-packages/django/db/migrations/autodetector.py",
 line 43, in changes
changes = self._detect_changes(convert_apps, graph)
  File 
"/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-packages/django/db/migrations/autodetector.py",
 line 165, in _detect_changes
old_field = self.old_apps.get_model(app_label, 
old_model_name)._meta.get_field(field_name)
  File 
"/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-packages/django/db/models/options.py",
 line 554, in get_field
raise FieldDoesNotExist('%s has no field named %r' % (self.object_name, 
field_name))
django.core.exceptions.FieldDoesNotExist: CustomerKey has no field named 
u'customer_key_cipher_text'

So, it seems that there are not migration, but still django complains for a 
missing field. 

However in the model the field is there


class CustomerKey(models.Model):...
customer_key_cipher_text = Base64Field(default='')

Any idea on what's the problem?


PS: the question is also on SO 
http://stackoverflow.com/questions/39333759/django-core-exceptions-fielddoesnotexist-but-the-field-exists


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/96c81cd5-9a49-47ce-90f8-7bab3096c927%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Csrf: when is it updated/generated?

2016-04-28 Thread Stefano Tranquillini
it says "A CSRF cookie that is set to a random value (a session independent 
nonce, as it is called),"  and later "For security reasons, the value of 
the CSRF cookie is changed each time a user logs in."

The value is the same in the two tabs because i've not performed the login, 
right? (and it reads the data from the cookie file) but from the first 
sentence it seems that every time i refresh the page (so i open it in a new 
tab) it should change (but if the value is in the cookie then it's not).



On Thursday, April 28, 2016 at 6:30:15 PM UTC+2, Tim Graham wrote:
>
> Did you read 
> https://docs.djangoproject.com/en/stable/ref/csrf/#how-it-works ?
>
> On Thursday, April 28, 2016 at 11:24:40 AM UTC-4, Stefano Tranquillini 
> wrote:
>>
>> Hello,
>> i was running a test on a website i dev with django and the system 
>> pointed out that "There are indications that attempts to protect against 
>> CSRF is in place. By using two different sessions the same tokens were 
>> retrieved. This may indicate a buggy behavior in the protection mechanism." 
>> . By checking it out  I opened two tabs of the login page and both have the 
>> same csfr token. This sounds strange to me, but maybe is not.
>> I've tried to look into the doc or in the group but I can't figure out if 
>> it's an intended behaviour or what.
>>
>> When is a csfr generate/updated?
>>
>> thanks.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/59c3de10-654b-403a-8c11-df6a778a8f53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Csrf: when is it updated/generated?

2016-04-28 Thread Stefano Tranquillini
Hello,
i was running a test on a website i dev with django and the system pointed 
out that "There are indications that attempts to protect against CSRF is in 
place. By using two different sessions the same tokens were retrieved. This 
may indicate a buggy behavior in the protection mechanism." . By checking 
it out  I opened two tabs of the login page and both have the same csfr 
token. This sounds strange to me, but maybe is not.
I've tried to look into the doc or in the group but I can't figure out if 
it's an intended behaviour or what.

When is a csfr generate/updated?

thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/84f9db1f-b1e4-4d97-8fa5-8b1e90eb7b01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django setup with elsatic beanstalk

2014-07-15 Thread Stefano Tranquillini
i gave up and create a  machine on AWS and deployed everything.
it's not that complex, u can find tutorial online .




On Sat, Jul 12, 2014 at 1:24 AM, Rob  wrote:

>   gmail.com> writes:
>
> >
> >
> > I'm having a similar problem - I don't see errors from the
> EB console - but django is not loaded I
> still get the standard AWS EB page.I have tried editing settings.py
> and app.config according to this
> tutorial:http://docs.aws.amazon.com/elasticbeanstalk
> /latest/dg/create_deploy_Python_django.htmla
> nd have tried many variations. If anyone has
> gotten this working from a windows machine - I would
> appreciate the help.ThxOn Monday, October 8,
> 2012 7:22:51 PM UTC+2, shlomi oberman wrote:
> > I'm trying without succes to setup a simple
> application using django with elastic beanstalk from my
> windows machine.Does anyone have any
> expreience with this? I am currently getting the following
> error from the EB console: "Your
> WSGIPath refers to a file that does not exist."
> >
> >
> >
> >
> >
>
>
> Did you ever solve this problem? I'm experiencing the same thing.
> I know the thread is a little old now.
>
> --
> 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/qzTomPSNK7c/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/loom.20140712T012206-551%40post.gmane.org
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Stefano

-- 
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/CAPQ1%3DkB%2B1XxqZeTRLD7NB7QBa6ver3E7uH492vPAovvw74vDOQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: StreamingHttpResponse into a Template

2013-02-28 Thread Stefano Tranquillini
Yes, you are perfectly right about the fact that this is a bad 
implementation.
the fact is that where i host the code it does not support celery (so far). 
so i've to find out a workaround to be able to process a bunch 
of external APIs Call (that include the one for sending email). 
we'll probably keep the javascript reloading to process junks, waiting for 
the support of celery.

BTW: the StreamingHttpResposnse, when should it be used? i get the example 
on the docs about writing a cvs, pdf or similar, but, what else?

Thanks for the help.

On Wednesday, February 27, 2013 6:23:52 PM UTC+1, Stefano Tranquillini 
wrote:
>
> Django 1.5 is just came out and it ships the StreamingHttpResponse. 
>
> What i want to do is to print the output of a stream response into a 
> template, having for example a bar that grows based on the streamed data 
> (something similar to a loading bar).
>
> so far i've found a solution that basically is to write the pieces of the 
> final html page into the generator function, so each yield does a 
> render_to_text of a piece of the final html page (i splitted it manually) 
> putting each time the data just processed. 
>
> The problem of this solution is that i can't have the loading bar. What 
> I'm able to have are incremental data, so i can print out the list of 
> processed data, but it's different to what i want to do.
>
> Is there a way to do what i would like to do? 
>
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




StreamingHttpResponse into a Template

2013-02-27 Thread Stefano Tranquillini


Django 1.5 is just came out and it ships the StreamingHttpResponse. 

What i want to do is to print the output of a stream response into a 
template, having for example a bar that grows based on the streamed data 
(something similar to a loading bar).

so far i've found a solution that basically is to write the pieces of the 
final html page into the generator function, so each yield does a 
render_to_text of a piece of the final html page (i splitted it manually) 
putting each time the data just processed. 

The problem of this solution is that i can't have the loading bar. What I'm 
able to have are incremental data, so i can print out the list of processed 
data, but it's different to what i want to do.

Is there a way to do what i would like to do? 

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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




App-structure: how to have a bunch of data in all the pages.

2013-02-05 Thread Stefano Tranquillini
Hi all.
i've a conceptual problem that i would like to solve. 
Let's take as example a blog.
In all the pages of the blog i would like to have a colum containing the 
list of tags and the list of the top-10 posts.

Now, i can create a base.html template where i render the data. but, how 
should i do the population of these lists?
Should i create a middleware that for each request populates the lists?
or what?

ciao

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Serve static files in production server

2013-01-02 Thread Stefano Tranquillini


On Sunday, December 30, 2012 6:01:24 PM UTC+1, Amirouche wrote:
>
> Héllo Stefano,
>
> On Sunday, December 30, 2012 1:27:12 PM UTC+1, Stefano Tranquillini wrote:
>>
>> Hi all.
>> in the appfog ML we were fighting again the possibility to serve static 
>> file in django without using an external server.
>> So far AF does not provide a setup of the server to split the server in 
>> static and dynamic (django) folders.
>> so, one of the solution is to use this
>>
>> # urls.py 
>> urlpatterns += patterns('', 
>> url(r'^static/(?P.*)$', 'django.views.static.serve', { 
>> 'document_root': settings.STATIC_ROOT}) 
>> )
>>
>> but, is it ok to use this trick in django or will it lead to problems 
>> (aka memory problems and stuff like that)?
>>
>
> The documentation state «Again, this view is *not* hardened for 
> production use» [1]
>
> What is the particular issue your are facing ? Maybe tproxy [2] can help.
>

the problem is that the appfog server does not provide a way to set up 
static part. so for convenience i (we) tried to use a workaround for 
solving the problem.

ciao
 

>
> Regards,
>
> Amirouche
>
> [1] 
> https://docs.djangoproject.com/en/dev/howto/static-files/#django.views.static.serve
> [2] https://github.com/benoitc/tproxy
>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/_Rh0njYy--UJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django setup with elsatic beanstalk

2012-11-29 Thread Stefano Tranquillini
i give up after a while.
every time it was a mess. and AWS is free for 12 months.
i switched to appfog, which actually runs for you stuff on AWS.
quite easy to set up and put code.
basically you need the requirements.txt (as for AWS).
and change a bit the setting.py

ciao


On Thu, Nov 29, 2012 at 3:29 AM, David Seelig <seel...@gmail.com> wrote:

> Did the eb update work? I ran into this same issue; seems like when
> creating the first instance it works, but the second time are problems:
> https://github.com/boto/boto/issues/1087
>
> According to that thread, if you delete the WSGIPath line and then create
> a new environment, you might have better luck..
> -D
>
>
> On Tuesday, October 30, 2012 7:43:29 AM UTC-7, Stefano Tranquillini wrote:
>>
>> Well
>> i was able to play with it only right now.
>> there's a thing i can't understand. what's the application.py?
>> i've back this error
>>
>>
>> 2012-10-30 14:28:42,890 [INFO] (26110 MainThread) 
>> [directoryHooksExecutor.py-28] [root directoryHooksExecutor info] Output 
>> from script: 2012-10-30 14:28:42,875 ERRORThe specified WSGIPath of 
>> "application.py" was not found in the source bundle
>>
>>
>>
>> and i don't have any application.py file in my folder .
>> this application.py i s specified in the .elasticbeanstalk/optionse**
>> ttings
>>
>> Il giorno mercoledì 24 ottobre 2012 14:06:52 UTC+2, Stefano Tranquillini
>> ha scritto:
>>>
>>> thx.
>>> later i try both yr suggestions. i haven;t been notified of the previous
>>> reply.
>>> thx
>>>
>>> On Wednesday, October 24, 2012 12:06:13 AM UTC+2, Andrzej Winnicki wrote:
>>>>
>>>>
>>>> Try also to change settings in .elasticbeanstalk/**optionsettings.
>>>>
>>>>
>>>> [aws:elasticbeanstalk:**application:environment]
>>>> DJANGO_SETTINGS_MODULE =
>>>> PARAM1 =
>>>> PARAM2 =
>>>> PARAM4 =
>>>> PARAM3 =
>>>> PARAM5 =
>>>>
>>>> [aws:elasticbeanstalk:**container:python]
>>>> WSGIPath = application.py
>>>> NumProcesses = 1
>>>> StaticFiles = /static=
>>>> NumThreads = 15
>>>>
>>>> [aws:elasticbeanstalk:**container:python:staticfiles]
>>>> /static =
>>>>
>>>>
>>>> Then type eb update and trick should work.
>>>>
>>>>
>>>> On Friday, 12 October 2012 11:54:37 UTC+2, Stefano Tranquillini wrote:
>>>>>
>>>>> Mmm. seems that i missing something.
>>>>>
>>>>> this is the log
>>>>>
>>>>> 2012-10-12 09:36:51,352 [INFO] (24716 MainThread)
>>>>> [directoryHooksExecutor.py-28] [root directoryHooksExecutor info] Output
>>>>> from script: 2012-10-12 09:36:51,331* ERRORThe specified WSGIPath
>>>>> of "application.py" was not found in the source bundle*
>>>>>
>>>>> 2012-10-12 09:36:51,353 [INFO] (24716 MainThread)
>>>>> [directoryHooksExecutor.py-28] [root directoryHooksExecutor info] Script
>>>>> succeeded.
>>>>> 2012-10-12 09:36:51,443 [INFO] (24641 MainThread) [command.py-126]
>>>>> [root command execute] Command returned: (code: 0, stdout: , stderr: None)
>>>>> 2012-10-12 09:36:51,449 [INFO] (24641 MainThread) [command.py-118]
>>>>> [root command execute] Executing command: Infra-EmbeddedPostBuild -
>>>>> AWSEBAutoScalingGroup
>>>>> 2012-10-12 09:36:52,621 [INFO] (24641 MainThread) [command.py-126]
>>>>> [root command execute] Command returned: (code: 1, stdout: Error occurred
>>>>> during build: Command 01_syncdb failed
>>>>> , stderr: None)
>>>>> 2012-10-12 09:36:52,623 [DEBUG] (24641 MainThread)
>>>>> [commandWrapper.py-60] [root commandWrapper main] Command result:
>>>>> {'status': 'FAILURE', 'results': [{'status': 'SUCCESS', 'config_set':
>>>>> u'Hook-PreAppDeploy', 'events': [*{'msg': 'Your WSGIPath refers to a
>>>>> file that does not exist.', 'timestamp': 1350034611, 'severity': 'ERROR'}]
>>>>> *}, {'status': 'FAILURE', 'config_set': u'Infra-EmbeddedPostBuild',
>>>>> 'returncode': 1, 'events': [], 'msg': 'Error occurred during build: 
>>>>> Command
>>>>> 01_syncdb failed\n'}], 'api_version': '1.0'}
>>>>>
>>>>> what's is this application.py (it's not mentioned in the tutorial

Re: google app engine suggestion

2012-11-12 Thread Stefano Tranquillini
Jumping in the thread. 
is GAE supporting django? i knew that something is supported but 
not completely (like db is non rel in GAE). 
is there a tutorial on how to set it up? what did you follow?
my 2 cents on the server, right now i'm using AWS free tier, it's for 
12months  and it's good. after that i'll switch to something else, which i 
didn't found yet. so suggestions are welcome (need to manage a 3 pages 
website with few queries and 2 celery scheduled tasks)

ciao

On Saturday, November 10, 2012 5:59:51 PM UTC+1, Aswani Kumar wrote:
>
> wow thank you, can any one of you write a blog post about how to setup 
> this environment or share a post which you have written earlier.
>
>
> With Best
> -Ashwin.
> +91-9959166266
>
>
>
> On Sat, Nov 10, 2012 at 10:19 PM, Javier Guerra Giraldez <
> jav...@guerrag.com > wrote:
>
>> On Sat, Nov 10, 2012 at 3:51 AM, Kurtis Mullins
>>  wrote:
>> > I, personally, prefer Nginx and uWSGI but something else may be better 
>> for
>> > your particular use case.
>>
>> same here.  it's a little different from other solutions, but rock
>> solid, and includes its own process management, so it's really close
>> to 'setup and forget about it'.
>>
>> of course, if/when your traffic outgrows your initial setup you have
>> to tune up and/or add more resources, but it has a lot of grow space.
>> you won't find it constraining until you become bigger than twitter.
>>
>> --
>> Javier
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> django-users...@googlegroups.com .
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/JBNTv5wQstoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django setup with elsatic beanstalk

2012-10-30 Thread Stefano Tranquillini
Well
i was able to play with it only right now.
there's a thing i can't understand. what's the application.py?
i've back this error 

2012-10-30 14:28:42,890 [INFO] (26110 MainThread) 
[directoryHooksExecutor.py-28] [root directoryHooksExecutor info] Output from 
script: 2012-10-30 14:28:42,875 ERRORThe specified WSGIPath of 
"application.py" was not found in the source bundle



and i don't have any application.py file in my folder .
this application.py i s specified in the .elasticbeanstalk/optionsettings

Il giorno mercoledì 24 ottobre 2012 14:06:52 UTC+2, Stefano Tranquillini ha 
scritto:
>
> thx.
> later i try both yr suggestions. i haven;t been notified of the previous 
> reply.
> thx
>
> On Wednesday, October 24, 2012 12:06:13 AM UTC+2, Andrzej Winnicki wrote:
>>
>> Try also to change settings in .elasticbeanstalk/optionsettings. 
>>
>>
>> [aws:elasticbeanstalk:application:environment]
>> DJANGO_SETTINGS_MODULE = 
>> PARAM1 = 
>> PARAM2 = 
>> PARAM4 = 
>> PARAM3 = 
>> PARAM5 = 
>>
>> [aws:elasticbeanstalk:container:python]
>> WSGIPath = application.py
>> NumProcesses = 1
>> StaticFiles = /static=
>> NumThreads = 15
>>
>> [aws:elasticbeanstalk:container:python:staticfiles]
>> /static = 
>>
>>
>> Then type eb update and trick should work.
>>
>>
>> On Friday, 12 October 2012 11:54:37 UTC+2, Stefano Tranquillini wrote:
>>>
>>> Mmm. seems that i missing something.
>>>
>>> this is the log
>>>
>>> 2012-10-12 09:36:51,352 [INFO] (24716 MainThread) 
>>> [directoryHooksExecutor.py-28] [root directoryHooksExecutor info] Output 
>>> from script: 2012-10-12 09:36:51,331* ERRORThe specified WSGIPath 
>>> of "application.py" was not found in the source bundle*
>>>
>>> 2012-10-12 09:36:51,353 [INFO] (24716 MainThread) 
>>> [directoryHooksExecutor.py-28] [root directoryHooksExecutor info] Script 
>>> succeeded.
>>> 2012-10-12 09:36:51,443 [INFO] (24641 MainThread) [command.py-126] [root 
>>> command execute] Command returned: (code: 0, stdout: , stderr: None)
>>> 2012-10-12 09:36:51,449 [INFO] (24641 MainThread) [command.py-118] [root 
>>> command execute] Executing command: Infra-EmbeddedPostBuild - 
>>> AWSEBAutoScalingGroup
>>> 2012-10-12 09:36:52,621 [INFO] (24641 MainThread) [command.py-126] [root 
>>> command execute] Command returned: (code: 1, stdout: Error occurred during 
>>> build: Command 01_syncdb failed
>>> , stderr: None)
>>> 2012-10-12 09:36:52,623 [DEBUG] (24641 MainThread) 
>>> [commandWrapper.py-60] [root commandWrapper main] Command result: 
>>> {'status': 'FAILURE', 'results': [{'status': 'SUCCESS', 'config_set': 
>>> u'Hook-PreAppDeploy', 'events': [*{'msg': 'Your WSGIPath refers to a 
>>> file that does not exist.', 'timestamp': 1350034611, 'severity': 'ERROR'}]
>>> *}, {'status': 'FAILURE', 'config_set': u'Infra-EmbeddedPostBuild', 
>>> 'returncode': 1, 'events': [], 'msg': 'Error occurred during build: Command 
>>> 01_syncdb failed\n'}], 'api_version': '1.0'}
>>>
>>> what's is this application.py (it's not mentioned in the tutorial) ? 
>>> idea about the WSGIPath?
>>>
>>> this is the directory tree:
>>>
>>> .
>>> |.ebextensions
>>> | |config
>>> |.elasticbeanstalk
>>> | |config
>>> | |optionsettings
>>>  |manage.py
>>> |mysites
>>> | |.DS_Store
>>> | |__init__.py
>>> | |__init__.pyc
>>> | |settings.py
>>> | |settings.pyc
>>> | |urls.py
>>> | |urls.pyc
>>> | |wsgi.py
>>> | |wsgi.pyc
>>> |requirements.txt
>>>
>>>
>>>
>>> two things. tutorial says that config file should be .config . it sounds 
>>> strange. 
>>> is it correct?
>>> where the requirements.txt should be located?
>>>
>>>
>>>
>>> On Thu, Oct 11, 2012 at 6:47 PM, Stefano Tranquillini <
>>> stefano.tr...@gmail.com> wrote:
>>>
>>>> same problem, did you solve it?
>>>>
>>>>
>>>> On Monday, October 8, 2012 7:22:51 PM UTC+2, shlomi oberman wrote:
>>>>>
>>>>> I'm trying without succes to setup a simple application using django 
>>>>> with elastic beanstalk from my windows machine.
>>>>> Does anyone have any expreience with this? I am currently getting the 
>>&g

Re: display additional information, best practice

2012-10-29 Thread Stefano Tranquillini
i gave it a look. but seems that detail view let me to display a model by 
just writing the template and not the view. right?
the point is, i've information that are not already in the object i want to 
display.
example:
i want to display the model called "Question" which has a set of "answers" 
given by "users"
now, how can i display for each question:
- the number of answer
- the number of correct answer
- the set of users who correctly answered.
?

can i do this with the detailview? beacuse i didn't find it out. or do i've 
to create a class to match the data i want to display and render this in a 
template?

On Sunday, October 28, 2012 10:03:21 PM UTC+1, Sergiy Khohlov wrote:
>
> Have you tried detailview ? 
> Also it is possible to add some values to the temple in view 
>
> 2012/10/28 Stefano Tranquillini <stefano.tr...@gmail.com >: 
> > Hi all. 
> > just a question about how to proceed. 
> > when i've to display data direct from the model (the db) one in a page 
> is 
> > simple. 
> > what if i want to display aggregate data or some data that needs logic? 
> > i've to do it in the view and add the object to the contex, or it's 
> better 
> > to do a custom tag filter? 
> > 
> > what if i've a list of objects and for each object i've to compute an 
> > aggregate data? 
> > for example i've a list of cars and for each car i want to know how many 
> > models exists. if i do in the view, how can i attach the aggregate data 
> > (which is a query) to each car? is it better to do with a custom tag 
> filter? 
> > 
> > ciao. 
> > 
> > -- 
> > Stefano 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Django users" group. 
> > To post to this group, send email to 
> > django...@googlegroups.com. 
>
> > To unsubscribe from this group, send email to 
> > django-users...@googlegroups.com . 
> > For more options, visit this group at 
> > http://groups.google.com/group/django-users?hl=en. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Jm4FDBT42dsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



display additional information, best practice

2012-10-28 Thread Stefano Tranquillini
Hi all.
just a question about how to proceed.
when i've to display data direct from the model (the db) one in a page is
simple.
what if i want to display aggregate data or some data that needs logic?
i've to do it in the view and add the object to the contex, or it's better
to do a custom tag filter?

what if i've a list of objects and for each object i've to compute an
aggregate data?
for example i've a list of cars and for each car i want to know how many
models exists. if i do in the view, how can i attach the aggregate data
(which is a query) to each car? is it better to do with a custom tag filter?

ciao.

-- 
Stefano

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django setup with elsatic beanstalk

2012-10-24 Thread Stefano Tranquillini
thx.
later i try both yr suggestions. i haven;t been notified of the previous 
reply.
thx

On Wednesday, October 24, 2012 12:06:13 AM UTC+2, Andrzej Winnicki wrote:
>
> Try also to change settings in .elasticbeanstalk/optionsettings. 
>
>
> [aws:elasticbeanstalk:application:environment]
> DJANGO_SETTINGS_MODULE = 
> PARAM1 = 
> PARAM2 = 
> PARAM4 = 
> PARAM3 = 
> PARAM5 = 
>
> [aws:elasticbeanstalk:container:python]
> WSGIPath = application.py
> NumProcesses = 1
> StaticFiles = /static=
> NumThreads = 15
>
> [aws:elasticbeanstalk:container:python:staticfiles]
> /static = 
>
>
> Then type eb update and trick should work.
>
>
> On Friday, 12 October 2012 11:54:37 UTC+2, Stefano Tranquillini wrote:
>>
>> Mmm. seems that i missing something.
>>
>> this is the log
>>
>> 2012-10-12 09:36:51,352 [INFO] (24716 MainThread) 
>> [directoryHooksExecutor.py-28] [root directoryHooksExecutor info] Output 
>> from script: 2012-10-12 09:36:51,331* ERRORThe specified WSGIPath of 
>> "application.py" was not found in the source bundle*
>>
>> 2012-10-12 09:36:51,353 [INFO] (24716 MainThread) 
>> [directoryHooksExecutor.py-28] [root directoryHooksExecutor info] Script 
>> succeeded.
>> 2012-10-12 09:36:51,443 [INFO] (24641 MainThread) [command.py-126] [root 
>> command execute] Command returned: (code: 0, stdout: , stderr: None)
>> 2012-10-12 09:36:51,449 [INFO] (24641 MainThread) [command.py-118] [root 
>> command execute] Executing command: Infra-EmbeddedPostBuild - 
>> AWSEBAutoScalingGroup
>> 2012-10-12 09:36:52,621 [INFO] (24641 MainThread) [command.py-126] [root 
>> command execute] Command returned: (code: 1, stdout: Error occurred during 
>> build: Command 01_syncdb failed
>> , stderr: None)
>> 2012-10-12 09:36:52,623 [DEBUG] (24641 MainThread) [commandWrapper.py-60] 
>> [root commandWrapper main] Command result: {'status': 'FAILURE', 'results': 
>> [{'status': 'SUCCESS', 'config_set': u'Hook-PreAppDeploy', 'events': 
>> [*{'msg': 
>> 'Your WSGIPath refers to a file that does not exist.', 'timestamp': 
>> 1350034611, 'severity': 'ERROR'}]*}, {'status': 'FAILURE', 'config_set': 
>> u'Infra-EmbeddedPostBuild', 'returncode': 1, 'events': [], 'msg': 'Error 
>> occurred during build: Command 01_syncdb failed\n'}], 'api_version': '1.0'}
>>
>> what's is this application.py (it's not mentioned in the tutorial) ? idea 
>> about the WSGIPath?
>>
>> this is the directory tree:
>>
>> .
>> |.ebextensions
>> | |config
>> |.elasticbeanstalk
>> | |config
>> | |optionsettings
>>  |manage.py
>> |mysites
>> | |.DS_Store
>> | |__init__.py
>> | |__init__.pyc
>> | |settings.py
>> | |settings.pyc
>> | |urls.py
>> | |urls.pyc
>> | |wsgi.py
>> | |wsgi.pyc
>> |requirements.txt
>>
>>
>>
>> two things. tutorial says that config file should be .config . it sounds 
>> strange. 
>> is it correct?
>> where the requirements.txt should be located?
>>
>>
>>
>> On Thu, Oct 11, 2012 at 6:47 PM, Stefano Tranquillini <
>> stefano.tr...@gmail.com> wrote:
>>
>>> same problem, did you solve it?
>>>
>>>
>>> On Monday, October 8, 2012 7:22:51 PM UTC+2, shlomi oberman wrote:
>>>>
>>>> I'm trying without succes to setup a simple application using django 
>>>> with elastic beanstalk from my windows machine.
>>>> Does anyone have any expreience with this? I am currently getting the 
>>>> following error from the EB console: 
>>>> "Your WSGIPath refers to a file that does not exist."
>>>>
>>>>  -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msg/django-users/-/WiWZ2EApeWUJ.
>>>
>>> To post to this group, send email to django...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> django-users...@googlegroups.com.
>>> For more options, visit this group at 
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>
>>
>> -- 
>> Stefano
>>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/CrszrQwUHzAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django setup with elsatic beanstalk

2012-10-12 Thread Stefano Tranquillini
Mmm. seems that i missing something.

this is the log

2012-10-12 09:36:51,352 [INFO] (24716 MainThread)
[directoryHooksExecutor.py-28] [root directoryHooksExecutor info] Output
from script: 2012-10-12 09:36:51,331* ERRORThe specified WSGIPath of
"application.py" was not found in the source bundle*

2012-10-12 09:36:51,353 [INFO] (24716 MainThread)
[directoryHooksExecutor.py-28] [root directoryHooksExecutor info] Script
succeeded.
2012-10-12 09:36:51,443 [INFO] (24641 MainThread) [command.py-126] [root
command execute] Command returned: (code: 0, stdout: , stderr: None)
2012-10-12 09:36:51,449 [INFO] (24641 MainThread) [command.py-118] [root
command execute] Executing command: Infra-EmbeddedPostBuild -
AWSEBAutoScalingGroup
2012-10-12 09:36:52,621 [INFO] (24641 MainThread) [command.py-126] [root
command execute] Command returned: (code: 1, stdout: Error occurred during
build: Command 01_syncdb failed
, stderr: None)
2012-10-12 09:36:52,623 [DEBUG] (24641 MainThread) [commandWrapper.py-60]
[root commandWrapper main] Command result: {'status': 'FAILURE', 'results':
[{'status': 'SUCCESS', 'config_set': u'Hook-PreAppDeploy', 'events': [*{'msg':
'Your WSGIPath refers to a file that does not exist.', 'timestamp':
1350034611, 'severity': 'ERROR'}]*}, {'status': 'FAILURE', 'config_set':
u'Infra-EmbeddedPostBuild', 'returncode': 1, 'events': [], 'msg': 'Error
occurred during build: Command 01_syncdb failed\n'}], 'api_version': '1.0'}

what's is this application.py (it's not mentioned in the tutorial) ? idea
about the WSGIPath?

this is the directory tree:

.
|.ebextensions
| |config
|.elasticbeanstalk
| |config
| |optionsettings
|manage.py
|mysites
| |.DS_Store
| |__init__.py
| |__init__.pyc
| |settings.py
| |settings.pyc
| |urls.py
| |urls.pyc
| |wsgi.py
| |wsgi.pyc
|requirements.txt



two things. tutorial says that config file should be .config . it sounds
strange.
is it correct?
where the requirements.txt should be located?



On Thu, Oct 11, 2012 at 6:47 PM, Stefano Tranquillini <
stefano.tranquill...@gmail.com> wrote:

> same problem, did you solve it?
>
>
> On Monday, October 8, 2012 7:22:51 PM UTC+2, shlomi oberman wrote:
>>
>> I'm trying without succes to setup a simple application using django with
>> elastic beanstalk from my windows machine.
>> Does anyone have any expreience with this? I am currently getting the
>> following error from the EB console:
>> "Your WSGIPath refers to a file that does not exist."
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/WiWZ2EApeWUJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Stefano

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django setup with elsatic beanstalk

2012-10-11 Thread Stefano Tranquillini
same problem, did you solve it?

On Monday, October 8, 2012 7:22:51 PM UTC+2, shlomi oberman wrote:
>
> I'm trying without succes to setup a simple application using django with 
> elastic beanstalk from my windows machine.
> Does anyone have any expreience with this? I am currently getting the 
> following error from the EB console: 
> "Your WSGIPath refers to a file that does not exist."
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/WiWZ2EApeWUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Update a model using UpdateView

2012-10-10 Thread Stefano Tranquillini
Ok thx. it make sense and does not seem too complex (as the others look 
like ;) ).


On Wednesday, October 10, 2012 1:17:08 PM UTC+2, Kurtis wrote:
>
> By the way, that 'owner' field would be something like this:
>
> owner = ForeignKey(User)
>
> And in my example, I use the Form to make sure the Owner is set properly.
>
> On Wed, Oct 10, 2012 at 7:14 AM, Kurtis Mullins 
> <kurtis@gmail.com
> > wrote:
>
>> You've got it. I included an 'owner' field on any model that I wanted to 
>> show ownership with. This is actually not too insanely hard as you could 
>> make a Parent Model or Mixin to make things easier.
>>
>> Another option is to use something like django-guardian to handle all of 
>> your permissions. However, the one time I've used it (required by a third 
>> party package) it wasn't the most pleasant experience in my opinion.
>>
>>
>> On Wed, Oct 10, 2012 at 3:39 AM, Stefano Tranquillini <
>> stefano.tr...@gmail.com > wrote:
>>
>>> Thanks.
>>> one question: this works great if you are modifying user data. in fact, 
>>> you do the checking 
>>>
>>> qs = super(RequestUpdateView, self).get_queryset()
>>> return qs.filter(owner=self.request.user)
>>>
>>>
>>> now. let's image i've a form (call it Task) that must be updated by 
>>> someone (or a group of user). how can i do this control?
>>> do i have to put a "owner" field in the Task model and check it later or 
>>> django does something of this automatically or exists a predefined way to 
>>> do it?
>>>
>>> ciao.
>>>
>>> On Tuesday, October 9, 2012 5:14:50 PM UTC+2, Kurtis wrote:
>>>
>>>> Check out my example of the updateview here: http://stackoverflow.**
>>>> com/questions/5531258/example-**of-django-class-based-**
>>>> deleteview/10903943#10903943<http://stackoverflow.com/questions/5531258/example-of-django-class-based-deleteview/10903943#10903943>
>>>>  
>>>> On Tue, Oct 9, 2012 at 10:48 AM, Stefano Tranquillini <
>>>> stefano.tr...@gmail.**com> wrote:
>>>>
>>>>> Hi all.
>>>>> I'm trying to let user update their values still having trouble.
>>>>>
>>>>> i've my models:
>>>>>
>>>>> class Language(models.Model):
>>>>> name = models.CharField(max_length=**100,default='')
>>>>> fb_id = models.IntegerField(default=0)
>>>>>
>>>>> def __unicode__(self):
>>>>> return str(self.fb_id)
>>>>>
>>>>> class UserProfile(models.Model):
>>>>> user = models.OneToOneField(User)
>>>>> name = models.CharField(max_length=**100,default='')
>>>>> surname = models.CharField(max_length=**100,default='')
>>>>> birthday = models.DateField(default=**datetime.now, blank=True)
>>>>> email = models.CharField(max_length=**100,default='')
>>>>> locale = models.CharField(max_length=**100,default='')
>>>>> picture = models.CharField(max_length=**255,default='')
>>>>> gender = models.CharField(max_length=**100,default='')
>>>>> hometown = models.CharField(max_length=**255,default='')
>>>>> #languages goes as 1-M relation
>>>>> languages = models.ManyToManyField(**Language)
>>>>>  latitude = models.FloatField(default=0.0)
>>>>> longitude = models.FloatField(default=0.0)
>>>>> reward_dollars = models.DecimalField(decimal_**
>>>>> places=2,max_digits=8,default=**0.0)
>>>>> reward_time = models.IntegerField(default=0)
>>>>> #checkins = models.TextField()
>>>>>
>>>>> def __unicode__(self):
>>>>> return self.name+' '+self.surname
>>>>>
>>>>>
>>>>> and i've create view and form
>>>>>
>>>>> class UpdateForm(BootstrapForm):
>>>>> username = forms.CharField(label=(u'name'**))
>>>>> name = forms.CharField(label=(u'**surname'))
>>>>> class Meta:
>>>>>  layout = (Fieldset("Test","name", "surname",))
>>>>>
>>>>> Here i used the 
>>>>> https://github.com/earle/**django-bootstrap<https://github.com/earle/django-bootstrap>beacuse
>>>>>  i've bootstrap as frontend.  
>>>&g

Re: Update a model using UpdateView

2012-10-10 Thread Stefano Tranquillini
Thanks.
one question: this works great if you are modifying user data. in fact, you 
do the checking 

qs = super(RequestUpdateView, self).get_queryset()
return qs.filter(owner=self.request.user)


now. let's image i've a form (call it Task) that must be updated by someone 
(or a group of user). how can i do this control?
do i have to put a "owner" field in the Task model and check it later or 
django does something of this automatically or exists a predefined way to 
do it?

ciao.

On Tuesday, October 9, 2012 5:14:50 PM UTC+2, Kurtis wrote:
>
> Check out my example of the updateview here: 
> http://stackoverflow.com/questions/5531258/example-of-django-class-based-deleteview/10903943#10903943
>
> On Tue, Oct 9, 2012 at 10:48 AM, Stefano Tranquillini <
> stefano.tr...@gmail.com > wrote:
>
>> Hi all.
>> I'm trying to let user update their values still having trouble.
>>
>> i've my models:
>>
>> class Language(models.Model):
>> name = models.CharField(max_length=100,default='')
>> fb_id = models.IntegerField(default=0)
>>
>> def __unicode__(self):
>> return str(self.fb_id)
>>
>> class UserProfile(models.Model):
>> user = models.OneToOneField(User)
>> name = models.CharField(max_length=100,default='')
>> surname = models.CharField(max_length=100,default='')
>> birthday = models.DateField(default=datetime.now, blank=True)
>> email = models.CharField(max_length=100,default='')
>> locale = models.CharField(max_length=100,default='')
>> picture = models.CharField(max_length=255,default='')
>> gender = models.CharField(max_length=100,default='')
>> hometown = models.CharField(max_length=255,default='')
>> #languages goes as 1-M relation
>> languages = models.ManyToManyField(Language)
>> latitude = models.FloatField(default=0.0)
>> longitude = models.FloatField(default=0.0)
>> reward_dollars = 
>> models.DecimalField(decimal_places=2,max_digits=8,default=0.0)
>> reward_time = models.IntegerField(default=0)
>> #checkins = models.TextField()
>>
>> def __unicode__(self):
>> return self.name+' '+self.surname
>>
>>
>> and i've create view and form
>>
>> class UpdateForm(BootstrapForm):
>> username = forms.CharField(label=(u'name'))
>> name = forms.CharField(label=(u'surname'))
>> class Meta:
>> layout = (Fieldset("Test","name", "surname",))
>>
>> Here i used the https://github.com/earle/django-bootstrap beacuse i've 
>> bootstrap as frontend.  
>> *Question:* do i have to create the form manually? or can django create 
>> it automatically for me?. in the second case, how can i deal with M-to-M 
>> relation or with the fact that i don't want to display some fields?
>>
>> class UserProfileUpdate(UpdateView):
>> form_class = UpdateForm
>> model = UserProfile
>> template_name = 'userprofile_form.html'
>> 
>> def get_object(self, queryset=None):
>> return UserProfile.objects.get(user=self.request.user)
>>
>>
>> in the urls
>>
>> url(r'^profile/update/$',UserProfileUpdate.as_view()),
>>
>>
>>
>> *Question:* here in the view i rewrote the get_object in order to get 
>> the current user. if i don't do it django wants a pk as parameters in the 
>> url, that's fine. but how can i assure that the user 1 can edits only the 
>> data of user 1 and not user 2. if he put /2/ in the url i get access to 
>> user 2 data.
>> In addition to this, image to have a forum and people can edits  post. 
>> how can i assure that each user can modifty only its posts? so avoid the 
>> fact that calling /update/{{idsomeoneelsepost}} they can edit a post.
>>
>> *Question:* do i've to implement the saving things or django does it 
>> automatically when data are POST (if so, how can i do that?)
>>
>> *Problem: *right now what i get by running this code is: __init__() got 
>> an unexpected keyword argument 'instance'
>>
>> I know that they can sounds as basic question, but i found that 
>> documentation of django is too detailed and miss examples while 
>> stackexchange and the like are questions that not always appliy to my need. 
>> do you have a good website or book with tutorials (i see there's a similar 
>> post from today)?
>>
>> ciao
>>
>>
>>
>>
>>
>> -- 
>> Stefano
>>  
>> -- 
>> You received this message because you are subscribed to the Goo

Re: django socialauth username not showing correctly

2012-10-10 Thread Stefano Tranquillini
Mmm...Social Auth has a pipe for creating the user when he logs in with the
social-auth.
You probably have to remove that and do the creation manually. Yet, I'm not
an expert, I've 4 days experience in this ;-).
give a look here
https://groups.google.com/forum/?fromgroups#!forum/django-social-auth


Il giorno 09/ott/2012 17:57, "psychok7" <nun...@gmail.com> ha scritto:

> yes you are right. i deleted the same name user and it works. but how can
> i control this with oauth users and users that register normally?
>
> On Tuesday, October 9, 2012 4:49:21 PM UTC+1, Stefano Tranquillini wrote:
>>
>> Django put numbers because you already have in the db a user with the fb
>> username.
>> check it.
>>
>> On Tuesday, October 9, 2012 5:19:00 PM UTC+2, psychok7 wrote:
>>>
>>> hey thanks for the reply. Can you point out some examples here i can get
>>> do all that in the right way?
>>>
>>> On Tuesday, October 9, 2012 3:15:13 PM UTC+1, Daniel Molina Wegener
>>> wrote:
>>>>
>>>> On 09/10/12 10:52, psychok7 wrote:
>>>> > So i am using django socialauth and its working fine, except for the
>>>> > part where my usernames do not match my Facebook or twitter accounts
>>>> > after i log in. In other words for example if i my username is
>>>> 'john',
>>>> > after i log in in my app it shows 'john820579c6960e4677'. What am i
>>>> > doing wrong? how can i make it look exactly like my Facebook account?
>>>>
>>>>You muse the GraphAPI service with the provided Access Token (code)
>>>> to access the Facebook Profile and get the real name. The Django
>>>> SocialAuth package just provides access services. Also, you must add
>>>> some special permissions to access certain profile data.
>>>>
>>>> >
>>>> > --
>>>>  > [SNIP]
>>>>
>>>> Kind regards,
>>>> --
>>>> Daniel Molina Wegener [dmw at coder dot cl]
>>>> @damowe | http://coder.cl/ | https://github.com/dmw
>>>>
>>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/3RyJKocJPRMJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django socialauth username not showing correctly

2012-10-09 Thread Stefano Tranquillini
Django put numbers because you already have in the db a user with the fb 
username. 
check it.

On Tuesday, October 9, 2012 5:19:00 PM UTC+2, psychok7 wrote:
>
> hey thanks for the reply. Can you point out some examples here i can get 
> do all that in the right way?
>
> On Tuesday, October 9, 2012 3:15:13 PM UTC+1, Daniel Molina Wegener wrote:
>>
>> On 09/10/12 10:52, psychok7 wrote: 
>> > So i am using django socialauth and its working fine, except for the 
>> > part where my usernames do not match my Facebook or twitter accounts 
>> > after i log in. In other words for example if i my username is 'john', 
>> > after i log in in my app it shows 'john820579c6960e4677'. What am i 
>> > doing wrong? how can i make it look exactly like my Facebook account? 
>>
>>You muse the GraphAPI service with the provided Access Token (code) 
>> to access the Facebook Profile and get the real name. The Django 
>> SocialAuth package just provides access services. Also, you must add 
>> some special permissions to access certain profile data. 
>>
>> > 
>> > -- 
>>  > [SNIP] 
>>
>> Kind regards, 
>> -- 
>> Daniel Molina Wegener [dmw at coder dot cl] 
>> @damowe | http://coder.cl/ | https://github.com/dmw 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ycfrshwTVZQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.