Thursday, April 30, 2015

Re: Question on auto-generating username while using django registration

Yes it is and very easy.

Create a form without a username field and do something like this:

def autogenerate_username ():
    # some logic

new_user=User.objects.create_user(autogenerate_username (),
                                  self.cleaned_data['email'],
                                  self.cleaned_data['password1'])
new_user.first_name = self.cleaned_data['first_name']
new_user.last_name = self.cleaned_data['last_name']
new_user.save()

On 1 May 2015 01:48, <emeka2106@gmail.com> wrote:
>
> Hi there -
> I'm in the process of building a site with django, and I noticed that username is a requirement for the django registration app.  I'm wondering if it's possible to auto generate the username after the user make entries in the other fields (i.e. name, city, email, password)?
>
> OR does django registration necessarily require the username to be created at the same time as the other fields?
>
> thanks in advance
>
> --
> 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+unsubscribe@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/26e45341-aa13-4404-9f42-c3c38061b753%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@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%2BWjgXNEqitXLwjMufNntqwU-QoL72O-AhTBHJ5FizQ%3DQdv28A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django oauth2 password encrypt

What is the view code that you are calling to actually create the user? I suspect you are simply doing something like:

user.password = <password value from POST>

That will store the password in plain text in the DB, but Django is expecting it to be hashed, so it never matches.

You should be using either the create_user() shortcut or using the set_password() method on the user object. See this:

https://docs.djangoproject.com/en/1.8/topics/auth/default/#changing-passwords

-James

On Apr 30, 2015 4:07 AM, "Shekar Tippur" <ctippur@gmail.com> wrote:
Hello,

I am having trouble with creating a user with encrypted password.

I am able to create a user with the call

curl -H "Authorization: Bearer lXbYKZqnPeqOyYaHyB3EOAvcMny13j" -X POST -d"username=foo1&password=bar1&first_name=foo1&email=" http://${endpoint}/users/

{"id":30,"password":"bar1","last_login":null,"is_superuser":false,"username":"foo1","first_name":"foo1","last_name":"","email":"","is_staff":false,"is_active":true,"date_joined":"2015-04-30T07:26:00.857445Z","groups":[],"user_permissions":[]}(env)

As you can see, it is creating a new user but the password is in clear text.

As a result, I am unable to get a user token

curl  -X POST -d "grant_type=password&username=foo1&password=bar1&scope=read" -u"${clientid}:${clientsecret}" http://${endpoint}/o/token/

{"error_description": "Invalid credentials given.", "error": "invalid_grant"}(env)

I sort of found a workaround. I can go in as admin to the console and change the user password manually. This seem to store the password as encrypted. How do I sole this via api calls?

I am sure I am missing something. Appreciate if someone could unblock me.

- Shekar

--
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+unsubscribe@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/ee2bc7a2-9103-41ec-8328-7db20a91c062%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@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%2Be%2BciX7U%2BfyHQAiAS4XEauUqWKru_jA5bK6NUcQEKuHgbHKVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Question on auto-generating username while using django registration

Hi there -
I'm in the process of building a site with django, and I noticed that username is a requirement for the django registration app.  I'm wondering if it's possible to auto generate the username after the user make entries in the other fields (i.e. name, city, email, password)?

OR does django registration necessarily require the username to be created at the same time as the other fields?

thanks in advance

--
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+unsubscribe@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/26e45341-aa13-4404-9f42-c3c38061b753%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: RemovedInDjango19Warning: Model class %s doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS ..

I attached a sample app here. You need to install django-haystack prior to running the app. haystack lets you define "Haystack Signal Processor". and in this signal processor, it attempts to load one of the models that belong to an app that is listed in INSTALLED_APPS after haystack. I would appreciate it if you could review this and see if it is a legit bug.. I will be more than happy to create a ticket for it.

Thank you

On Wednesday, April 29, 2015 at 3:14:34 PM UTC-7, Carl Meyer wrote:
Hi,

On 04/29/2015 11:13 AM, Bumyong Choi wrote:
> I am trying to understand this warning better. I understand that we want
> to make sure that a model has an explicit app_label or it is in
> INSTALLED_APPS. I spent some time trying to remove warnings from my code
> because I was getting these warning messages even though my model was
> defined in an app listed in INSTALLED_APPS.
>
> After scratching my head for quite some time, I put a breakpoint on the
> following line of the code in django.db.models.base:
>
> # Look for an application configuration to attach the model to.
>
> app_config =apps.get_containing_app_config(module)
>
> And I checked to see what I get for "app_configs.values()" and I
> realized that the app is in INSTALLED_APPS but not yet been loaded. This
> was because one of the third party framework I use was trying to import
> models before they were loaded.
>
> My question is the following:
>
> Is Django trying to prevent a model from being imported before this
> model is actually defined? If this is the case, is it possible to
> improve the warning so that it would check "INSTALLED_APPS" and warn the
> user that even if the app is listed there some other app is trying to
> import the model before the app is loaded?"

Yes, that is the current intention in Django 1.7+: you may not import a
models.py file before the app cache has been prepared. (I personally
think this is unfortunate, but to change it while maintaining consistent
and predictable semantics would require a deep reworking of how relation
fields are initialized, which nobody has so far attempted).

I'm surprised you are getting that particular error though - if a
models.py file is imported too soon, I would expect an "App registry not
ready" error instead. So it may be a bug that you are getting this error
message instead of that one; hard to know without seeing code to
reproduce the issue.

Carl

--
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+unsubscribe@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/233ad1eb-cb9a-465f-9df6-f68934a96218%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

The best way to mock querysets

Who practices TDD (XP like) says that the tests need to run quickly. For this, we have to mock all external resources of the method that i want to test.

In the case of queryset, i think so strange. Eg: https://gist.github.com/edgabaldi/ffdffa60f2add650f052

Am i doing it wrong? Do i have better way to do 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+unsubscribe@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/CAGjPPHkvcPGusgTzddJ3SVtfeGhgQCZb4L9tOq8vWgY9OoP8zQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: What's the better way to get settings.DEBUG in a view?

Thanks... works now!

T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
Twitter: @fh_bash

On Thu, Apr 30, 2015 at 3:36 PM, Nelson Varela <nelson.c.varela@gmail.com> wrote:
from django.conf import settings

--
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+unsubscribe@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/6d6b46b7-12d6-4ce9-8cf9-caf69f98247e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@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/CAF1jwZHUtvoAyuqgZ3WE4sZPN%2BL%3DFeniu%3DpNcN5vznLg4xBWew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

What's the better way to get settings.DEBUG in a view?

from django.conf import settings

--
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+unsubscribe@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/6d6b46b7-12d6-4ce9-8cf9-caf69f98247e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

What's the better way to get settings.DEBUG in a view?

Hi,

I have one view, and I want to get de DEBUG value..

if I try these:

import settings

if settings.DEBUG:

or:

from settings import DEBUG

if DEBUG:

show me these error:

File "views.py", line 19, in <module>
    import settings
  File "settings.py", line 178, in <module>
    from .settings_local import *
SystemError: Parent module '' not loaded, cannot perform relative import


So, what's the better way to get these value?

Regards,

T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
Twitter: @fh_bash

--
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+unsubscribe@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/CAF1jwZF8md7Cv43RvC1HENm7EEpCqPme8DLm2aCFdCdi2L_zjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: “Migrate” command for manage.py not recognised when using Django 1.8

What does `manage.py --version` say?

On Thursday, April 30, 2015 at 12:30:17 PM UTC-4, Kaya Luken wrote:
Hi Markus,

I don't have South installed as I am using Django 1.8, and have never used a previous version. 

For the record INSTALLED_APPS == ['django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles']

As you say migration support should be built in, which is why I am having difficulty understanding the problem.

--
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+unsubscribe@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/20676f3f-6123-4d4b-9e3c-1cf0e6fd06a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: “Migrate” command for manage.py not recognised when using Django 1.8

Hi Markus,

I don't have South installed as I am using Django 1.8, and have never used a previous version. 

For the record INSTALLED_APPS == ['django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles']

As you say migration support should be built in, which is why I am having difficulty understanding the problem.

--
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+unsubscribe@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/51e6b2b0-d859-40f5-896b-8e7029460cc7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: How to find a view in a complex web application

Hi Thomas

I do not I understand your question; I made a suggestion previously for what fields you might need in this 'metadata' model, and you can add or change as needed.  I do not know what your project looks like, so I cannot comment on what the rest of your database should contain.

Derek

On Thursday, 30 April 2015 13:26:25 UTC+2, guettli wrote:
Hi Derek,

yes, your idea looks good.

Next question would be: How to lay out the database structure (models)?

Regards,
  Thomas

Am Dienstag, 28. April 2015 16:04:35 UTC+2 schrieb Derek:
A quick "brain storm"...

One idea could be to keep all the metadata for your views - their full name; abbreviated name; aliases (alternate names); URL; keywords; and categories etc. in a single table.  You could then use this table to generate *multiple* possible ways for a user to "find" the view they need.

For example - you could present a list of categories (and sub-categories, and sub-sub-categories) which could be presented in a expandable list (jQuery-style).

You could create a tag-cloud and allow a user to 'expand' a single tag into related-views.

You could allow a user to create their own tags for searching and display (in a many-to-many table linked to user).

You could allow a user to "favourite" some of the views and allow the user to easily see (list/sort/search) those.

And, of course, a simple search button could be created to allow an 'incremental' display (auto-complete Google-style) of all possible matches from all fields in your table...

I am sure there are other ways you could think of to generate navigation options, including fancy graphic ones!

You would have to 'admin' this table of course, but the data in it could be changed dynamically (e.g. adding more categories and aliases) without affecting the logic of your app.

[Hey - this could even make a cool app on its own!]

Hope these ideas help....  my project is a just a boring menu-driven one.

Derek


On Tuesday, 28 April 2015 11:27:47 UTC+2, guettli wrote:
We have a complex intranet application.

It has many view.

The problem: How to find the view a user wants to use?

A huge sitemap HTML does not help.

Is there a way to search the matching view?

Maybe even with auto complete?


--
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+unsubscribe@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/701ba7ce-e777-4094-8e37-3a2b246e4276%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: “Migrate” command for manage.py not recognised when using Django 1.8

Hey Kaya,

I suspect you have South installed and in your INSTALLED_APPS. This is not supported. South only supports Django <=1.6 -- Django >=1.7 has built-in migration support. Please see https://docs.djangoproject.com/en/dev/topics/migrations/#upgrading-from-south for a migration guide from South to Django migrations.

/Markus

On Thursday, April 30, 2015 at 6:04:38 PM UTC+2, Kaya Luken wrote:

Using "path/to/mySite/manage.py migrate" I get

Unknown command: 'migrate'  Type 'manage.py help' for usage.

Listed commands are:

changepassword    cleanup    compilemessages    createcachetable    createsuperuser    dbshell    diffsettings    dumpdata    flush    inspectdb    loaddata    makemessages    reset    runfcgi    runserver    shell    sql    sqlall    sqlclear    sqlcustom    sqlflush    sqlindexes    sqlinitialdata    sqlreset    sqlsequencereset    startapp    syncdb    test    testserver    validate

I believe "Migrate" was added as a native command for manage.py as of Django 1.7. According to "pip list" and the package documentation I am definitely using Django 1.8 and I explicitly called the correct versions of django-admin.py and manage.py in setup.

--
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+unsubscribe@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/4bda26ca-1bcf-4b13-9812-508b26cc72e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

“Migrate” command for manage.py not recognised when using Django 1.8

Using "path/to/mySite/manage.py migrate" I get

Unknown command: 'migrate'  Type 'manage.py help' for usage.

Listed commands are:

changepassword    cleanup    compilemessages    createcachetable    createsuperuser    dbshell    diffsettings    dumpdata    flush    inspectdb    loaddata    makemessages    reset    runfcgi    runserver    shell    sql    sqlall    sqlclear    sqlcustom    sqlflush    sqlindexes    sqlinitialdata    sqlreset    sqlsequencereset    startapp    syncdb    test    testserver    validate

I believe "Migrate" was added as a native command for manage.py as of Django 1.7. According to "pip list" and the package documentation I am definitely using Django 1.8 and I explicitly called the correct versions of django-admin.py and manage.py in setup.

--
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+unsubscribe@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/ad6aeb0e-7707-4fe8-bb07-bef44d559249%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: How to find a view in a complex web application

Hi Derek,

yes, your idea looks good.

Next question would be: How to lay out the database structure (models)?

Regards,
  Thomas

Am Dienstag, 28. April 2015 16:04:35 UTC+2 schrieb Derek:
A quick "brain storm"...

One idea could be to keep all the metadata for your views - their full name; abbreviated name; aliases (alternate names); URL; keywords; and categories etc. in a single table.  You could then use this table to generate *multiple* possible ways for a user to "find" the view they need.

For example - you could present a list of categories (and sub-categories, and sub-sub-categories) which could be presented in a expandable list (jQuery-style).

You could create a tag-cloud and allow a user to 'expand' a single tag into related-views.

You could allow a user to create their own tags for searching and display (in a many-to-many table linked to user).

You could allow a user to "favourite" some of the views and allow the user to easily see (list/sort/search) those.

And, of course, a simple search button could be created to allow an 'incremental' display (auto-complete Google-style) of all possible matches from all fields in your table...

I am sure there are other ways you could think of to generate navigation options, including fancy graphic ones!

You would have to 'admin' this table of course, but the data in it could be changed dynamically (e.g. adding more categories and aliases) without affecting the logic of your app.

[Hey - this could even make a cool app on its own!]

Hope these ideas help....  my project is a just a boring menu-driven one.

Derek


On Tuesday, 28 April 2015 11:27:47 UTC+2, guettli wrote:
We have a complex intranet application.

It has many view.

The problem: How to find the view a user wants to use?

A huge sitemap HTML does not help.

Is there a way to search the matching view?

Maybe even with auto complete?


--
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+unsubscribe@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/c24246d5-a053-418f-a196-3b9b026dd6bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: How to find a view in a complex web application



Am Dienstag, 28. April 2015 16:49:18 UTC+2 schrieb Andrew Farrell:
If you are asking this question as a developer who wants to know what view to use to affect a page when you know the url, I recommend you install The Silver Searcher, which lets you run 

$ ag 'some arbitrary text you might find on a page'

and it will quickly show you every place that text occurs in the entire directory tree where you run the command. This will show you what template is being rendered. Then, you can take the name of that template and do something like.

$ ag 'orders/unfulfilled.html'

and you will see which view is rendering that template.



No, I was looking at my pages through the glasses of a user.

For search in code I use pyCharm.

--
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+unsubscribe@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/bd57cc98-e613-4c24-bc93-72faf32d3124%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Connection timeouts on high load

On Thu, Apr 30, 2015 at 10:00 AM, sephii <sylvaintersideral@gmail.com> wrote:
> Hello,
>
> I have an application made with Django 1.7 and the Django Rest
> Framework and I'm in the phase of load testing it. My setup is made of
> 3 servers:
>
> - Nginx + gunicorn
> - Gunicorn
> - Postgresql + Memcached
>
> Nginx is configured as a loadbalancer so I can add more gunicorn
> instances if needed. In the current setup it already balances the load
> between its own gunicorn instance and the other server with the
> gunicorn instance. The project code is on the loadbalancer and it's
> shared on the gunicorn server via an NFS share.

I would not do that, but it is unlikely to cause many issues. NFS has
many gotchas.

>
> I'm using Locustio to simulate about 4000 users, that make a request
> every 30-60 seconds, with about 200 new users per second. The servers
> are handling the load until I get to about 2000 users, and then nginx
> starts returning 502 and 504 errors with the following in the logs:

I think you are being wildly optimistic about the performance of a
single app server. If the app server is not overloaded, add more
workers, if it is, add more app servers. Add some sort of monitoring
(I like munin) to all the servers to measure load - cpu, interrupts,
memory, disk io, memcached stats, postgre stats, nginx stats - and see
where your bottleneck is.

On the plus side, if you have 4000 users making requests every 30
seconds, you'll be able to afford many app servers ;)

Cheers

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+unsubscribe@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/CAFHbX1Lzw2j2XRKCU3RNFqV7uZZW3%3Dp%3Da8cj%3DNo88gKiYj_XJg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Connection timeouts on high load

Hello,

I have an application made with Django 1.7 and the Django Rest
Framework and I'm in the phase of load testing it. My setup is made of
3 servers:

- Nginx + gunicorn
- Gunicorn
- Postgresql + Memcached

Nginx is configured as a loadbalancer so I can add more gunicorn
instances if needed. In the current setup it already balances the load
between its own gunicorn instance and the other server with the
gunicorn instance. The project code is on the loadbalancer and it's
shared on the gunicorn server via an NFS share.

I'm using Locustio to simulate about 4000 users, that make a request
every 30-60 seconds, with about 200 new users per second. The servers
are handling the load until I get to about 2000 users, and then nginx
starts returning 502 and 504 errors with the following in the logs:

upstream timed out (110: Connection timed out) while connecting to upstream
recv() failed (104: Connection reset by peer) while reading response
header from upstream

I know most of the load is caused by the (high) hatch rate, since
every new simulated user goes through an account creation phase, which
I guess is quite slow because of the password hashing. But even when
all users have been created and are just doing regular requests, I
keep getting a failure rate of about 6% (with the same errors as
before), even though the gunicorn workers have plenty of CPU to use. I
checked the I/O (both network and disk) and there's no problem here.

Do you have any advice on where I could look or what tool I could use
to have an idea of what's going on?

Here's my gunicorn config:

bind = "0.0.0.0:8000"
workers = 8
preload_app = True
loglevel = 'info'
pidfile = '/home/myproject/gunicorn.pid'

And my nginx config:

upstream myproject {
    server 127.0.0.1:8000 weight=2 fail_timeout=0;
    server ip_of_gunicorn_server:8000 fail_timeout=0;
}

proxy_pass http://myproject;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_read_timeout 300;
proxy_redirect off;

Thank you for your help,
Sylvain

--
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+unsubscribe@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/3fcb77d5-b1b5-4958-abe6-0ac80fa62970%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Django oauth2 password encrypt

Hello,
I am following instructions under https://django-oauth-toolkit.readthedocs.org/en/latest/rest-framework/getting_started.html

I am having trouble with creating a user with encrypted password.

I am able to create a user with the call

curl -H "Authorization: Bearer lXbYKZqnPeqOyYaHyB3EOAvcMny13j" -X POST -d"username=foo1&password=bar1&first_name=foo1&email=" http://${endpoint}/users/

{"id":30,"password":"bar1","last_login":null,"is_superuser":false,"username":"foo1","first_name":"foo1","last_name":"","email":"","is_staff":false,"is_active":true,"date_joined":"2015-04-30T07:26:00.857445Z","groups":[],"user_permissions":[]}(env)

As you can see, it is creating a new user but the password is in clear text.

As a result, I am unable to get a user token

curl  -X POST -d "grant_type=password&username=foo1&password=bar1&scope=read" -u"${clientid}:${clientsecret}" http://${endpoint}/o/token/

{"error_description": "Invalid credentials given.", "error": "invalid_grant"}(env)

I sort of found a workaround. I can go in as admin to the console and change the user password manually. This seem to store the password as encrypted. How do I sole this via api calls?

I am sure I am missing something. Appreciate if someone could unblock me.

- Shekar

--
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+unsubscribe@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/ee2bc7a2-9103-41ec-8328-7db20a91c062%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Django oauth2 encrypt password

Hello,
I am following instructions under https://django-oauth-toolkit.readthedocs.org/en/latest/rest-framework/getting_started.html

I am having trouble with creating a user with encrypted password.

I am able to create a user with the call

curl -H "Authorization: Bearer lXbYKZqnPeqOyYaHyB3EOAvcMny13j" -X POST -d"username=foo1&password=bar1&first_name=foo1&email=foo1@screens.com" http://${endpoint}/users/

{"id":30,"password":"bar1","last_login":null,"is_superuser":false,"username":"foo1","first_name":"foo1","last_name":"","email":"foo1@screens.com","is_staff":false,"is_active":true,"date_joined":"2015-04-30T07:26:00.857445Z","groups":[],"user_permissions":[]}(env)

As you can see, it is creating a new user but the password is in clear text.

As a result, I am unable to get a user token

curl  -X POST -d "grant_type=password&username=foo1&password=bar1&scope=read" -u"${clientid}:${clientsecret}" http://${endpoint}/o/token/

{"error_description": "Invalid credentials given.", "error": "invalid_grant"}(env)

I sort of found a workaround. I can go in as admin to the console and change the user password manually. This seem to store the password as encrypted. How do I sole this via api calls?

I am sure I am missing something. Appreciate if someone could unblock me.

- Shekar

--
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+unsubscribe@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/7aead7cf-7aa1-49bd-877e-2ec41e48da8d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

django oauth2 create user with encrypted password

Hello,

I am trying to create user using django-oauth-toolkit module. I am follwing instructions under https://django-oauth-toolkit.readthedocs.org/en/latest/rest-framework/getting_started.html
I am able to create a user using basic curl

curl -H "Authorization: Bearer lXbYKZqnPeqOyYaHyB3EOAvcMny13j" -X POST -d"username=foo1&password=bar1&first_name=foo1&email=foo1@screens.com" http://${endpoint}/users/

However, the password is stored as clear text. As a result, I am not able to get a user token to do further api calls.

I have a workaround where I go in as admin via the console and go to the specific user and recreate the password. As you can see, this is not scalable. I am sure I am missing something here.

Appreciate if someone could unblock me.

- Shekar

--
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+unsubscribe@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/cd1666cd-6aa1-4a12-ada2-ae306458c73b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wednesday, April 29, 2015

Re: Django runserver needs restart on psql data changes

Hi Carl - that was *exactly* what I was doing - thanks a ton for finding that issue even without requiring the code. Now that I think about it, putting that definition in the global section makes absolutely no sense.

Appreciate your feedback,
-AB

On Wednesday, April 29, 2015 at 5:10:21 PM UTC-5, Carl Meyer wrote:
Hi Arnab,

On 04/29/2015 03:13 PM, Arnab Banerji wrote:
> Hi Javier - thanks for the response. Yes - I am storing the data in a
> dictionary - then having django_tables2 API render the dictionary as a
> table. How do I force a read of that variable for every browser refresh
> on the client side?

Using a variable is fine; the problem is that (I'm guessing) you are
creating that variable at the top level of the module. Such code is only
run once, when the module is first imported.

You need to make sure that all database queries are run only inside view
functions (or methods of view classes), never at the top-level of a module.

carl

--
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+unsubscribe@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/346855d5-2e89-4ccd-a2e7-0531a9573971%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

upload csv file from different directories

Hi I am writing an app that upload csv file and write csv data to models. So far everything is working fine. What i want to do now is to be able get the users to be able to upload csv files from different directories.  I cannot seem to figure this out, i need directions. form the  function csvimport is there are a way to get the user select the file from different directories, instead of hard coding the path (with open('/var/www/html/webapp/csvupload/data1.csv')

here is my codes.

view.py

def showuploadform(request):
    if request.method=='POST':
        form = uploadform(request.POST, request.FILES)
        if form.is_valid():
            csvimport(request.FILES['Select_CSV_Files'])
            return render_to_response('csv_test.html',locals())
    else:
        form = uploadform()
    return render(request,'uploadform.html',{'form': form})



def csvimport(request):
    with open('/var/www/html/webapp/csvupload/data1.csv','rb') as csvfile:
        readata=csv.reader(csvfile,delimiter=',', quotechar='"')
        for row in readata:
            if row[0] != 'PersonID':
                data=csvfiles()
                data.PersonID=row[0]
                data.Firstname=row[1]
                data.Lastname=row[2]
                data.Address=row[3]
                data.save()
        return render_to_response('csv_test.html',locals())

forms.py

class uploadform(forms.Form):
    Select_CSV_Files=forms.FileField()

uploadform.html



<form enctype="multipart/form-data" action ="/showuploadform/" method="post">{%csrf_token%}
<table>
{{form.as_table}}
</table>
<br>
<input type="submit" name="submit" value="Upload Files" > 
</form>



{%endblock%}

--
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+unsubscribe@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/CAPCf-y4Zofe-Q1YsQRqMY2qUj0bBfSTpbzOJqs%2Btyn7z4Y5XDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: RemovedInDjango19Warning: Model class %s doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS ..

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJVQVexAAoJEC0ft5FqUuEhNHYP/joTs0hgPnzYdn9WFqwuOdGG
25vMrFSXNkMbHqIQL2uPdj7JUyXbYJxefR4B8DUAitT1YZbsFt1ckhhaOUopNFJS
W7IDHrTYlYe74wsKQ7mFyBaaFTzZEv7ZlBcOLIkctRwhRPp2YPc7d+LUS+EeB2mL
j6oVAcr5lRQdI+QedMmEKs+QhLyhD7oghYgI8EZDKdZ2vJ47rMbeOSrVstVewTWQ
BPRo9RuNpZXYjoc3Ow+Z5DC4lvaFwq7NM+J6Q3QV62iFUJyqAf/WOWR3KIT9WR53
eRgg370dxCYKvcGiUKkr++h5JF1Vwqnk9f/GrB1PIQZ2t0htw0SQjUQ9+/pu35JE
q4ezW8W4wIeduWBS2wUp4Lto0OE2XrwN5GCWRqnBfuamd1hnCQ1zvEJRjMsJg7HQ
hUEOnxXPLZagwA5+y5QyZVxOYhgFE2oygDBEjlbhejYZVP6hKHKkqbkFCmshk8Jr
n5pmIgP3CZgf9UUd9jJCXGDH0g33EY0xDTvIkZmEE3evWn6rQg58D8jg54cD4h5w
M1z8h+TmVCkse6T9TAfKeXLmErtxU7XDXs6Ll7GFv4Ly3OXYJEJnqDT0fNzygV5w
8xhMZsoN62p2R+OUDlGyK5jzWs5SGubaXMZmA+qYosOFceUPdecV5Fto/pffP2iu
hChzjBqyLxnftkBYf8vH
=7QEa
-----END PGP SIGNATURE-----
Hi,

On 04/29/2015 11:13 AM, Bumyong Choi wrote:
> I am trying to understand this warning better. I understand that we want
> to make sure that a model has an explicit app_label or it is in
> INSTALLED_APPS. I spent some time trying to remove warnings from my code
> because I was getting these warning messages even though my model was
> defined in an app listed in INSTALLED_APPS.
>
> After scratching my head for quite some time, I put a breakpoint on the
> following line of the code in django.db.models.base:
>
> # Look for an application configuration to attach the model to.
>
> app_config =apps.get_containing_app_config(module)
>
> And I checked to see what I get for "app_configs.values()" and I
> realized that the app is in INSTALLED_APPS but not yet been loaded. This
> was because one of the third party framework I use was trying to import
> models before they were loaded.
>
> My question is the following:
>
> Is Django trying to prevent a model from being imported before this
> model is actually defined? If this is the case, is it possible to
> improve the warning so that it would check "INSTALLED_APPS" and warn the
> user that even if the app is listed there some other app is trying to
> import the model before the app is loaded?"

Yes, that is the current intention in Django 1.7+: you may not import a
models.py file before the app cache has been prepared. (I personally
think this is unfortunate, but to change it while maintaining consistent
and predictable semantics would require a deep reworking of how relation
fields are initialized, which nobody has so far attempted).

I'm surprised you are getting that particular error though - if a
models.py file is imported too soon, I would expect an "App registry not
ready" error instead. So it may be a bug that you are getting this error
message instead of that one; hard to know without seeing code to
reproduce the issue.

Carl

--
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+unsubscribe@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/554157B1.5000702%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.

Re: Django runserver needs restart on psql data changes

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJVQVaNAAoJEC0ft5FqUuEhPpIQAK44SApGdUgk22ajVQALexOB
nYJb4sN5vHYHlYX0HlWayi1cQp7fSUOEUHPTG+CtrjXptaINcr7/5jIgSQ4fn+Sr
SHBd9L4dJY+UHthbm7qSBg5j5LmCRjTbMaALby8SZkWO/iXqp/kE1+DPfcyd2d8k
zIztsiB5uYtaDKWNQC/ubuObdcLg3q013huSmcEzWcy3Zm0f1wduWkYP8buffNkG
I8uiPyvMnR1FSD0BYYsU/0tKQqOXJLfpJOkJ86ndvKEgYxorCOwRGRZo3P3nvho7
lPySyDF7W9vSNj3fWjht7Vwmcca1FduDePWcyPbfNfNJqeWL2kmzUfxuA6bAczoY
Eo+SmK1ul2O3jsXI7WBj7ufs+fjdM6qfNVld4UmvCjURUC9ZgATYUjDimNbYvhOk
d78p4MBLMJK1oaTAizEAz0lq9OgP8RN8niXuhArj8KggGTTIvUZ6+pkj2ZQU/qT+
GnX2keSjYQAy2hHr7Svb2C0jf5PketcrBf6X12IQKyOMut9YG4twcNhvuhhr8Ama
iZRlcMYPmosDq6m/lP+pcF75Y3j1RgDsJo4wXfDM06gmcspUSR3L166Z/BHsOR87
x/VkDsIrIuuXjlm90PtJg5ZWJhRMAKdyLXFqIzCgt0i4iMxroNX4c6GFVi//L3RH
Oh7+LNqcG4/REd5MEbE8
=i3Tv
-----END PGP SIGNATURE-----
Hi Arnab,

On 04/29/2015 03:13 PM, Arnab Banerji wrote:
> Hi Javier - thanks for the response. Yes - I am storing the data in a
> dictionary - then having django_tables2 API render the dictionary as a
> table. How do I force a read of that variable for every browser refresh
> on the client side?

Using a variable is fine; the problem is that (I'm guessing) you are
creating that variable at the top level of the module. Such code is only
run once, when the module is first imported.

You need to make sure that all database queries are run only inside view
functions (or methods of view classes), never at the top-level of a module.

carl

--
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+unsubscribe@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/5541568D.1060808%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.

Re: Django runserver needs restart on psql data changes

Hi Javier - thanks for the response. Yes - I am storing the data in a dictionary - then having django_tables2 API render the dictionary as a table. How do I force a read of that variable for every browser refresh on the client side? 

Thanks for your time,
-AB

On Wednesday, April 29, 2015 at 3:09:26 PM UTC-5, Javier Guerra wrote:
On Wed, Apr 29, 2015 at 12:35 PM, Arnab Banerji <arn...@gmail.com> wrote:
> The rendering happens perfectly, but the problem is - when the client user
> does a browser refresh, the new data does not get reloaded until I restart
> the runserver. Is there something I am doing wrong with respect to getting
> the data from the database and into my view?


sounds like you're storing that data in a variable.  you should either
read it from database on every request, or get some cache invalidation
techniques.

--
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+unsubscribe@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/3d2af574-e329-41ca-b2f2-1d1ba03f991e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django runserver needs restart on psql data changes

On Wed, Apr 29, 2015 at 12:35 PM, Arnab Banerji <arnab79@gmail.com> wrote:
> The rendering happens perfectly, but the problem is - when the client user
> does a browser refresh, the new data does not get reloaded until I restart
> the runserver. Is there something I am doing wrong with respect to getting
> the data from the database and into my view?


sounds like you're storing that data in a variable. you should either
read it from database on every request, or get some cache invalidation
techniques.

--
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+unsubscribe@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/CAFkDaoTY%3Dfxx7RHRKjjJsHJaAvUJoDtL1fS1-dgM2MeifsaVjg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Django runserver needs restart on psql data changes

Hi all - I am working on a Django app that interacts with a psql database via a set of models. 

(1) There is a backend job which keeps updating the database via the same models. 

(2) I am creating a table with a view using django_tables2 - and giving it a custom dictionary to render using data from the psql database (via my Django models). 

(3) I am using 'runserver' fpr testing out my code. 

The rendering happens perfectly, but the problem is - when the client user does a browser refresh, the new data does not get reloaded until I restart the runserver. Is there something I am doing wrong with respect to getting the data from the database and into my view?

Appreciate any help you might give me on this topic,
-AB

--
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+unsubscribe@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/08207f93-9c4a-4c98-8fca-6499e6735125%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

RemovedInDjango19Warning: Model class %s doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS ..

I am trying to understand this warning better. I understand that we want to make sure that a model has an explicit app_label or it is in INSTALLED_APPS. I spent some time trying to remove warnings from my code because I was getting these warning messages even though my model was defined in an app listed in INSTALLED_APPS. 

After scratching my head for quite some time, I put a breakpoint on the following line of the code in django.db.models.base:



# Look for an application configuration to attach the model to.

app_config = apps.get_containing_app_config(module)


And I checked to see what I get for "app_configs.values()" and I realized that the app is in INSTALLED_APPS but not yet been loaded. This was because one of the third party framework I use was trying to import models before they were loaded. 

My question is the following:

Is Django trying to prevent a model from being imported before this model is actually defined? If this is the case, is it possible to improve the warning so that it would check "INSTALLED_APPS" and warn the user that even if the app is listed there some other app is trying to import the model before the app is loaded?"

If the intention is not as aforementioned, is this a bug?

Thank you

--
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+unsubscribe@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/ea782849-8c6a-48b1-92e2-1cdfabf15c4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Django BooleanField Checkbox Returns Empty

I read every corner of the documentation but couldn't figure out why the BooleanField Form doesn't return 'True' when the checkbox is checked. Is this a valid test? Shouldn't formset.cleaned_data = [{True}, {False}]?



>>> from django import forms
>>> from django.forms.formsets import formset_factory
>>>
>>> class CheckBox (forms.Form):
...    overwrite = forms.BooleanField (required = False)
...
>>>
>>> data = {
...     'form-TOTAL_FORMS': '2',
...     'form-INITIAL_FORMS': '0',
...     'form-MAX_NUM_FORMS': '3',
...     'checkbox-0-overwrite': True,
...     'checkbox-1-overwrite': False,
...}
>>>
>>> CheckboxFormSet = formset_factory (CheckBox)
>>> formset = CheckboxFormSet (data)
>>> formset.is_valid ()
True
>>> formset.cleaned_data
[{}, {}]
>>>


--
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+unsubscribe@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/2fe2c1e6-5644-464e-8e35-36d22e5257b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: clear database (drop all tables)

As usual, StackOverflow to the rescue ...

http://stackoverflow.com/questions/3414247/django-drop-all-tables-from-database


On Wednesday, 29 April 2015 12:11:51 UTC+2, lars van Gemerden wrote:
Hi all,

Is there a simple programmatic way to drop all tables in the database (e.g. for testing purposes), also without input prompts?

Cheers, Lars

--
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+unsubscribe@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/ae2099c6-9fea-46a9-928d-f5aa99cc7afb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: clear database (drop all tables)

With suitable privileges, you can drop the database and recreate it.  In at least some databases the user privilege grants are not lost with the database and don't have to be recreated when the database is.

And, if you're using SQLite, just remove the file.

On Wed, Apr 29, 2015 at 6:10 AM, lars van Gemerden <lars@rational-it.com> wrote:
Hi all,

Is there a simple programmatic way to drop all tables in the database (e.g. for testing purposes), also without input prompts?

Cheers, Lars

--
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+unsubscribe@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/0ebbbdb5-f9ad-437b-baaa-9a39358704cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@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/CAB%2BAj0vtNMzONsamOT1tinWDQFCF3k9Q29yFitq7nowBUecdWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Require code explaination

Well the response does not seem to contain the audio file, to the best of my knowledge Django does not implement X-Accel-Redirect, are you running all this on the same machine? Maybe your browser is getting the file ? Seems unlikely. Have you tried something like 'curl' to make the request in debug mode to see what is coming over the wire back from Django?

F.

> On Apr 29, 2015, at 8:28 AM, Anubhav Kaushik <anubhavgreen41@gmail.com> wrote:
>
> yes i am working on this code but i havnt wrote this code otherwise i would not have required the explaination i guess.
>
> and for your second question , i am not sure coz as you said it looked like nginx directive , but i am running it on default wsgi server included in django . so i am asking how wsgi server is serving what a nginx is supposed to serve?
>
> On Wednesday, April 29, 2015 at 5:35:26 PM UTC+5:30, François Schiettecatte wrote:
> You need to be a little more specific about what the context is, and what you are observing, rather than just plastering up some code.
>
> - Is this code in an app you are working with ? Did you write this code ?
>
> - Is the audio file being served by your application through the default wsgi server included in django?
>
> F.
>
> > On Apr 29, 2015, at 7:55 AM, Anubhav Kaushik <anubhav...@gmail.com> wrote:
> >
> > but i am not running ny nginx server , m just running default wsgi server with django ,and files are still served file ,can you explain how that is happening?
> >
> > On Wednesday, April 29, 2015 at 5:10:56 PM UTC+5:30, François Schiettecatte wrote:
> > I found this page which was pretty clear I think:
> >
> > http://wiki.nginx.org/XSendfile
> >
> > Looks like an nginx directive to serve a file as the content of the response.
> >
> > F.
> >
> > > On Apr 29, 2015, at 7:28 AM, Anubhav Kaushik <anubhav...@gmail.com> wrote:
> > >
> > > yes francois ,when i searched the term ,all i got was links related to nginx.
> > >
> > > On Wednesday, April 29, 2015 at 4:55:58 PM UTC+5:30, François Schiettecatte wrote:
> > > Which part do you mean? The 'X-Accel-Redirect' ?
> > >
> > > François
> > >
> > > > On Apr 29, 2015, at 6:08 AM, Anubhav Kaushik <anubhav...@gmail.com> wrote:
> > > >
> > > > response = HttpResponse()
> > > >
> > > > protected = settings.PROTECTED_AUDIO_ROOT + path
> > > >
> > > > logger.info('Protected path: %s', protected)
> > > >
> > > > response["X-Accel-Redirect"] = protected
> > > >
> > > > response["Content-Type"] = "audio/mpeg"
> > > >
> > > > return response
> > > >
> > > > --
> > > > You received this message because you are subscribed to the Google Groups "Django users" group.
> > > > To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> > > > To post to this group, send email to django...@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/f59471d6-1baa-4a36-9d3c-327684049d65%40googlegroups.com.
> > > > For more options, visit https://groups.google.com/d/optout.
> > >
> > >
> > > --
> > > You received this message because you are subscribed to the Google Groups "Django users" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> > > To post to this group, send email to django...@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/b29c48fc-cb9d-49dd-869f-140afd5d1b6d%40googlegroups.com.
> > > For more options, visit https://groups.google.com/d/optout.
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> > To post to this group, send email to django...@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/e158ec09-020a-4b80-9913-c0e2c3eccc8a%40googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@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/d0fd944b-f5b5-4a91-b228-60612ea7b333%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@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/5183A208-0B24-47DC-87BD-18B5BD4ED3D2%40gmail.com.
For more options, visit https://groups.google.com/d/optout.