Re: Should I use Django-Rest-Framework for performance reasons, despite not needing an externally-consumable API?

2018-10-26 Thread Andréas Kühne
Hi, I really don't get why you would want to do that? If you are doing only a "standard" website - you don't want or NEED the extra complexity of running DRF. It's not that DRF is hard to setup - but for example if you want to present a list of items - in "standard" django, you create the list and

Re: Should I use Django-Rest-Framework for performance reasons, despite not needing an externally-consumable API?

2018-10-26 Thread PASCUAL Eric
Hi, Using DRF can help when there is a need for decoupling the presentation layer from the logic one, for instance if the logic is planned to be used in other scenarios that the interactive Web app. One can argue that structuring the logic as a Python package can do it, but this will not wor

Re: New entry tries to use an existing unique id

2018-10-26 Thread Sanjay Bhangar
Hi Michel, So, a little explanation of why you're facing this issue: When you create an "auto-increment" field in Postgres, Postgres creates something called a "sequence" to keep track of the increments. If you were to `psql` into your database and check the schema of the table, you'll see the `i

Re: New entry tries to use an existing unique id

2018-10-26 Thread Michel Lavoie
Wow thank you Sanjay, this is beyond helpful! I'll try the steps you suggested; I need the ids to remain the same. Michel On Friday, October 26, 2018 at 6:25:09 AM UTC-4, Sanjay Bhangar wrote: > > Hi Michel, > > So, a little explanation of why you're facing this issue: > > When you create an "au

Re: New entry tries to use an existing unique id

2018-10-26 Thread Michel Lavoie
All good now, thanks again. I ended up using this one-liner to do what you described: SELECT setval('table_id_seq', (SELECT MAX(id) FROM table)); Found here: https://gist.github.com/henriquemenezes/962829815e8e7875f5f4376133b2f209 Michel On Friday, October 26, 2018 at 7:10:53 AM UTC-4, Michel

Experienced django developer is needed.

2018-10-26 Thread deb.dasit2013
Hi, I am experienced Django/Python developer. Kindly provide the details. -- 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.c

Re: Should I use Django-Rest-Framework for performance reasons, despite not needing an externally-consumable API?

2018-10-26 Thread Tyler Lynch
Hi Andréas, Thanks for getting back to me! I guess adding DRF to my project right now would be a case of premature-optimization then. I had a bit of muddied thinking such that I thought DRF might help with caching the database queries, but I guess that is completely independent of DRF? Is the

Re: Should I use Django-Rest-Framework for performance reasons, despite not needing an externally-consumable API?

2018-10-26 Thread Tyler Lynch
Hi Eric, Thanks for the response You mention that adding DRF can actually make you lose some potential benefits from caching? Might i ask how that is so? I actually thought it was supposed to be the opposite (shows you what I know tho hah) I guess DRF can be added to the project at any time th

Re: Should I use Django-Rest-Framework for performance reasons, despite not needing an externally-consumable API?

2018-10-26 Thread Andréas Kühne
Hi again, I don't think there is any performance reason to add DRF. You should architect your application in a way that the database is the main speed issue (for example, avoid doing loops in python) - then you can add som caching to the queries that you know can be cached. That would give you the

Weird messages in my console

2018-10-26 Thread Mark Phillips
I am building a django 2.0 application, and I have noticed some strange output in my console when I use runserver. I use logging a lot to follow what is happening in my code as I write it, so there are a lot of logging messages in the console. However, these weird messages do not have the same form

Re: Can't install mysqlclient

2018-10-26 Thread Ing.Daniel Bojorge
For avoid problem, It's better in python start with a Virtual Environment Dios L@s Bendiga Saludos, [image: --] daniel.bojorge [image: http://]about.me/daniel.bojorge *Curso Django 2.1* Mi Blog

Re: Can't install mysqlclient

2018-10-26 Thread Swetank Subham Roy
If you are on Linux(debian): You should first install libmysqlclient-dev using command $ sudo apt-get install libmysqlclient-dev Then proceed with installing mysqlclient through pip... For more information you can follow link: https://pypi.org/project/mysqlclient/ On Thu 25 Oct, 2018, 6:59 PM

Channels -- a question about how ProtocolTypeRouter works

2018-10-26 Thread Zhiyu/Drew Li
Hi, Newbie here. (please bear with me if this a stupid question) I am going through the tutorial and doc and got this question regarding how ProtocolTypeRouter works. ProtocolTypeRouter.__init__ takes a dict "application_mapping" and append a key-value pair to it: "http': class AsgiHandler As

Re: Should I use Django-Rest-Framework for performance reasons, despite not needing an externally-consumable API?

2018-10-26 Thread PASCUAL Eric
Hi, You mention that adding DRF can actually make you lose some potential benefits from caching? Django does a lot of job WRT caching data at the ORM level and there is a "direct path" from the UI and the ORM. I've the feeling that putting a REST API in the middle have chances to defeat some

Re: Channels -- a question about how ProtocolTypeRouter works

2018-10-26 Thread Andrew Godwin
Hi Drew, The return value is indeed an object, but if you look closely at it you'll see it defines a __call__ method - meaning that when it's called as an ASGI application, it then returns a further object to act inside the scope. Andrew On Fri, Oct 26, 2018 at 2:55 PM Zhiyu/Drew Li wrote: > H

Re: Channels -- a question about how ProtocolTypeRouter works

2018-10-26 Thread Zhiyu (Drew) Li
Thanks! So that means some objects last across multiple scopes, and they can create another obj that only lasts for one specific scope? I am still confused how the different layers of middleware wrap around the real asgi application -- a obj just lasts for one scope. I need to go through the code

Re: Channels -- a question about how ProtocolTypeRouter works

2018-10-26 Thread Andrew Godwin
I would instead think of the object that ends up there as a factory that makes the final objects that end up per-scope. It's slightly confusing, I will grant you, but in Python anything can make a new class instance, not just a class constructor, which is what's happening here. Andrew On Fri, Oct

html multi button form using in django app

2018-10-26 Thread Xristos Xristoou
down votefavorite I have a html form with multi buttons and html tabs processing for every button(for example after to push button n01 i take tab 2 with button n02 after push button n02 i take tab 3 wit

Re: Is assertIs being misused in Tutorial Part 5?

2018-10-26 Thread John Meyer
> > The reason why assertIs is used instead of assertFalse is that the latter > actually tests for falsy values and can sometimes hide bugs. I understand that if the return type is not pure boolean, it can still evaluate to a boolean value. I tested the following and it possible to do the ty

Re: Is assertIs being misused in Tutorial Part 5?

2018-10-26 Thread John Meyer
O, I see what you are saying; False is not really a bool.When the function returns a false value, the code returns the following: AssertionError: False is not >>> >>> >>> >>>

Re: Network analysis tool

2018-10-26 Thread Ryan Nowakowski
It depends on what you want to do. If you want to use websockets then channels is a great choice. If you want to have long running background processes then channels is good for most things. Alternatively, Celery is a bit more mature and full-featured. On October 25, 2018 3:21:58 AM CDT, daniel

Re: Trigger actions independently of url request

2018-10-26 Thread Ryan Nowakowski
Celery is probably what you want. It allows you to run scheduled tasks. Alternatively, you can create a custom management command and run that periodically some other way: Cron, etc. On October 22, 2018 3:11:09 PM CDT, Charley Paulus wrote: >Hi Andrew, > >Thank you for your answer. > >To bette

Re: Trigger actions independently of url request

2018-10-26 Thread Joel
There's nothing that prevents you from doing the necessary imports of your django model and other required modules in a python script, and then have it run by cron. Is there? I've operated python scripts outside of the django application, just to import certain files into the database, which needs

Re: Network analysis tool

2018-10-26 Thread daniel main
Thanks for the reply. I want to create an interface that will visualize the TCP and UDP dump data and also a section showing the upload and download speeds On Oct 27, 2018 04:52, "Ryan Nowakowski" wrote: > It depends on what you want to do. If you want to use websockets then > channels is a grea

NOT ABLE TO INSTALL REQUIREMENT FILES

2018-10-26 Thread Dennis Alabi
I'm trying to clone an app into virtual environment but i keep getting the error below. Please what should i do about this " error: command 'cl.exe' failed: No such file or directory" Part of the code is shown below. rs c:\users\user\envs\ososo\include\site\python3.6\rjsmin: running in