Re: How to solve django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server during query')?

2018-11-14 Thread Krishnasagar Subhedarpage
Hi Prateek,

Did you check disk info of server instance? What's disk consumption?

Regards,
Krishnasagar Subhedarpage




On Thu, 15 Nov 2018 at 12:09, prateek gupta  wrote:

> It is strange again, now I am getting the same error.
> Till morning it was working fine but now it is again showing same error.
>
> On Wednesday, November 14, 2018 at 7:07:46 PM UTC+5:30, Jason wrote:
>>
>> also, you might want to update your mysqlclient package.  1.3.12 was
>> released over a year ago, and 1.3.13 was pushed out late June of this year.
>>
> --
> 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/9bd1c72a-7c97-49b5-8a37-646e49dbc785%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+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/CAChYJc-kazkgi0km1rfJRP4S%3D9v6Lfv0Wq4pBy12U6EhNu_Scw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django jobs

2018-11-14 Thread Ryan Gedwill
Yeah, it’s hard to just learn the pythonic way of doing things. It’s a mix of 
functional and OOP practice with a bunch of built in stuff that you wouldn’t 
know unless you came across it. This is kind of why python can come across as a 
cult sometimes ;)

One book that I recommend for learning some pythonic ways of doing things is 
“Data science from Scratch” by Joel Grutch Of course it’s focused on an intro 
to basic data science, but anyone capable of programming and isn’t afraid of 
pretty basic math can follow along, and the way he codes his examples are very 
pythonic so you’ll pick up a lot of cool tricks. I’d also just suggest googling 
examples of pythonic code and you’ll get some good examples.

What I said in my earlier response may have came across as the opposite of what 
I meant though, I meant don’t let the pythonic way of doing things get in the 
way of doing things correctly in a way that is easier to maintain. It’s easy to 
write sloppy code with python due to its scripting nature, but it’s important 
to remember good OOP design principles and proper project architectures.

Sent from my iPhone

> On Nov 14, 2018, at 8:33 PM, Mike Dewhirst  wrote:
> 
>> On 15/11/2018 2:28 PM, Joel Mathew wrote:
>> The last point is a bit of a sore for me. I'm well versed with some other 
>> languages including perl, C, and javascript. Python seems to have "pythonic" 
>> ways of doing stuff that's at loggerheads with all other languages. Is there 
>> a single resource to learn the pythonic way of doing things?
> 
> Not sure about a single resource for Python. For Django however, there is Two 
> Scoops of Django which claims to (and I believe) aggregate best practices for 
> the web framework.
> 
> There are lots Python gurus who do presentations at PyCons around the world. 
> Plenty of blogs and tutorials as well. Raymond Hettinger comes to mind.
> 
> Google python best practices and there are heaps to choose from. You should 
> pick up a sense of it by scanning a few of those pages.
> 
> 
> 
>> Like, say for perl, there's Larry's books, which provide a solid foundation 
>> for best practices.
>> 
>> Sincerely yours,
>> 
>> Joel G Mathew
>> 
>> 
>> 
>> On Thu, 15 Nov 2018 at 08:49, Ryan Gedwill > > wrote:
>> 
>>No problem!
>> 
>>Also as a side note to the point that you heard django is slow...
>> 
>>Django is extremely scalable, which of course requires speed. 
>>It’s probably the most popular web framework among startups of any
>>magnitude (at least from what I’ve seen) by a mile.
>> 
>>Django certainly may require some extra optimization compared to
>>something like ASP.NET , just like scaling any
>>python software, but there are ways around a lot of it that are
>>well understood.
>> 
>>Instagram and Venmo are written in django, which is proof that it
>>can be scaled with the rest of the big players in the industry.
>> 
>>There are certainly problems with scaling python and Django, a
>>perfect language/framework doesn’t exist, but there are benefits
>>to both python and Django that can be worth the tradeoff.
>> 
>>In addition to the fact that both Django and python are so
>>flexible and stay up to date with modern trends as well as any of
>>their competitors, I always suggest learning them compared to the
>>other options out there. Just don’t let python get in the way of
>>writing good code, because as a beginner it’s really easy to
>>forget best practices with it.
>> 
>>Sent from my iPhone
>> 
>>On Nov 14, 2018, at 6:46 PM, Arturo Fernandez >> wrote:
>> 
>>>Thanks :)
>>> 
>>>On Wednesday, November 14, 2018 at 9:41:35 PM UTC-5, Ryan Gedwill
>>>wrote:
>>> 
>>>I live in the SF Bay Area and there are no shortage of jobs
>>>in Django. It is true there are also plenty of jobs in Node,
>>>but you can’t compare a framework to a backend language. I
>>>see far more python jobs than node jobs.
>>> 
>>>2 things to keep in mind though (for reference I’m a
>>>python/Django dev but have experience in node and c# as well):
>>> 
>>>1. Just because something is very popular doesn’t mean it’s
>>>the easiest to get a job in. There may be more python/JS jobs
>>>out there, but there are also way more people applying to
>>>them. There are plenty of .NET jobs out there, and far less
>>>entry level developers who are looking for them. Nearly every
>>>single entry level developer is looking for those python/JS jobs
>>>2. Often times the language and framework you’re experienced
>>>in doesn’t matter. I recently had an interview for a Go
>>>position, and I was allowed to pick which language I wanted
>>>to do the interview in. Most web development jobs are looking
>>>for your understanding of general software and web
>>> 

Re: How to solve django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server during query')?

2018-11-14 Thread prateek gupta
It is strange again, now I am getting the same error.
Till morning it was working fine but now it is again showing same error.

On Wednesday, November 14, 2018 at 7:07:46 PM UTC+5:30, Jason wrote:
>
> also, you might want to update your mysqlclient package.  1.3.12 was 
> released over a year ago, and 1.3.13 was pushed out late June of this year.
>

-- 
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/9bd1c72a-7c97-49b5-8a37-646e49dbc785%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to fix (2027, 'Malformed packet') exception?

2018-11-14 Thread prateek gupta
Hi All,

I am facing a strange issue in my pre-prod server (in dev and uat it's 
working fine).
Whenever I login in django admin and click on any table, it shows me 
following error- (2027, 'Malformed packet')

[image: db_error.JPG]

Is there any db setting I am missing here or its is related to server 
settings?
Has anyone faced this issue?

Thanks,
Prateek

-- 
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/7fade990-6b6f-4691-a9c5-dd63c6cdaebb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django jobs

2018-11-14 Thread Mike Dewhirst

On 15/11/2018 2:28 PM, Joel Mathew wrote:
The last point is a bit of a sore for me. I'm well versed with some 
other languages including perl, C, and javascript. Python seems to 
have "pythonic" ways of doing stuff that's at loggerheads with all 
other languages. Is there a single resource to learn the pythonic way 
of doing things?


Not sure about a single resource for Python. For Django however, there 
is Two Scoops of Django which claims to (and I believe) aggregate best 
practices for the web framework.


There are lots Python gurus who do presentations at PyCons around the 
world. Plenty of blogs and tutorials as well. Raymond Hettinger comes to 
mind.


Google python best practices and there are heaps to choose from. You 
should pick up a sense of it by scanning a few of those pages.




Like, say for perl, there's Larry's books, which provide a solid 
foundation for best practices.


Sincerely yours,

Joel G Mathew



On Thu, 15 Nov 2018 at 08:49, Ryan Gedwill > wrote:


No problem!

Also as a side note to the point that you heard django is slow...

Django is extremely scalable, which of course requires speed. 
It’s probably the most popular web framework among startups of any
magnitude (at least from what I’ve seen) by a mile.

Django certainly may require some extra optimization compared to
something like ASP.NET , just like scaling any
python software, but there are ways around a lot of it that are
well understood.

Instagram and Venmo are written in django, which is proof that it
can be scaled with the rest of the big players in the industry.

There are certainly problems with scaling python and Django, a
perfect language/framework doesn’t exist, but there are benefits
to both python and Django that can be worth the tradeoff.

In addition to the fact that both Django and python are so
flexible and stay up to date with modern trends as well as any of
their competitors, I always suggest learning them compared to the
other options out there. Just don’t let python get in the way of
writing good code, because as a beginner it’s really easy to
forget best practices with it.

Sent from my iPhone

On Nov 14, 2018, at 6:46 PM, Arturo Fernandez mailto:afern...@gmail.com>> wrote:


Thanks :)

On Wednesday, November 14, 2018 at 9:41:35 PM UTC-5, Ryan Gedwill
wrote:

I live in the SF Bay Area and there are no shortage of jobs
in Django. It is true there are also plenty of jobs in Node,
but you can’t compare a framework to a backend language. I
see far more python jobs than node jobs.

2 things to keep in mind though (for reference I’m a
python/Django dev but have experience in node and c# as well):

1. Just because something is very popular doesn’t mean it’s
the easiest to get a job in. There may be more python/JS jobs
out there, but there are also way more people applying to
them. There are plenty of .NET jobs out there, and far less
entry level developers who are looking for them. Nearly every
single entry level developer is looking for those python/JS jobs
2. Often times the language and framework you’re experienced
in doesn’t matter. I recently had an interview for a Go
position, and I was allowed to pick which language I wanted
to do the interview in. Most web development jobs are looking
for your understanding of general software and web
development principles. If you understand html/css/js, sql
databases in regards to MVC architecture, MVC architecture
itself, and REST API’s and requests, it probably won’t matter
what language as long as you can prove it. Knowing the
language and framework of the company you’re applying to is
kind of just brownie points and improves your chances. If I’m
amazing at django and web development but don’t know the
language being used, I’ll generally be chosen over someone
who’s shaky on web development who uses the same language as
the company

Sent from my iPhone

On Nov 14, 2018, at 6:18 PM, Arturo Fernandez
 wrote:


Hello community, today someone at work told me to bare in
mind which tech I use in terms of profitability. As a
backend language, there is no doubt that I'll use Python,
however I'm doubting about the framework, whether I should
use Python or not for web.
I heard that Django is kind of slow, and also there amount
of jobs are decreasing. Is that true? I initiated my web
experience with Node.js, but I don't want to continue it due
to the instability. A friend recommend me .Net, so I have
all this kind of doubts in my head. Can someone help me
clear my mind? This is probably the best/not the 

Re: How to solve django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server during query')?

2018-11-14 Thread prateek gupta
Thanks Jason!
I have restarted teh server and updated the mysqlclient to 1.3.13 and the 
issue got resolved now.

On Wednesday, November 14, 2018 at 7:07:46 PM UTC+5:30, Jason wrote:
>
> also, you might want to update your mysqlclient package.  1.3.12 was 
> released over a year ago, and 1.3.13 was pushed out late June of this year.
>

-- 
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/b8f0cc45-418d-4b55-aeed-92f2b114c80d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why does my Django project open the same home page irrespective or which url I type?

2018-11-14 Thread Manjunath
Also,
It would be better if you rearrange your patterns.

urlpatterns=[
path('login/', LoginView.as_view(template_name='accounts/login.html'), 
name='login'),
re_path(r'^$',views.home, name='home'),
]

Since your path *r'^$' *matches all request, it is better to keep this at 
end of your list.

On Tuesday, November 13, 2018 at 7:19:22 AM UTC+5:30, Alex Callaway wrote:
>
> In my urlpatterns in the url.py file of my app, I have two pages:
>
> from django.urls import path, re_path
> from django.conf.urls import url
> from . import views
> from django.contrib.auth.views import LoginView
>
> urlpatterns=[
> re_path(r'^$',views.home, name='home'),
> path('login/', LoginView.as_view(template_name='accounts/login.html'), 
> name='login'),
> ]
>
> When I visit : `http://127.0.0.1:8000/home`  
> I see whats in my `index.html`. 
>
> But when I visit : 
>
> `http://127.0.0.1:8000/accounts/login` 
>  or 
> `http://127.0.0.1:8000/accounts/login.html` 
>  or 
> `http://127.0.0.1:8000/accounts/login/login` 
>  or 
> `http://127.0.0.1:8000/accounts/login/login/login.html` 
>  
>
> I still see what's in my `index.html`. Wtf?
>
>
> Ok. I did say in my views.py I have told it to render `home/index.html` 
> like this :
>
> def home(request):
> return render(request, 'home/index.html')
>
> But I also have this function in views.py as well :
>
>
> def login(request):
> c = {}
> c.update(csrf(request))
> return render(request, 'accounts/login.html', c)
>
> So what's the problem? Why won't it render `accounts/login.html` page when 
> I visit `http://127.0.0.1:8000/accounts/login` 
> 
>
> By the way, In my main url.py file in the project, I have url patterns 
> this way *(every django project has two urls.py)*:
> urlpatterns = [
> path('admin/', admin.site.urls),
> path('home/', include('clientview.urls')),
> path('accounts/login/', include('clientview.urls')),
> ]
>
>

-- 
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/2622b5d3-8bcd-4277-a94e-1df2a11e8023%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django jobs

2018-11-14 Thread Joel Mathew
The last point is a bit of a sore for me. I'm well versed with some other
languages including perl, C, and javascript. Python seems to have
"pythonic" ways of doing stuff that's at loggerheads with all other
languages. Is there a single resource to learn the pythonic way of doing
things? Like, say for perl, there's Larry's books, which provide a solid
foundation for best practices.

Sincerely yours,

Joel G Mathew



On Thu, 15 Nov 2018 at 08:49, Ryan Gedwill  wrote:

> No problem!
>
> Also as a side note to the point that you heard django is slow...
>
> Django is extremely scalable, which of course requires speed.  It’s
> probably the most popular web framework among startups of any magnitude (at
> least from what I’ve seen) by a mile.
>
> Django certainly may require some extra optimization compared to something
> like ASP.NET, just like scaling any python software, but there are ways
> around a lot of it that are well understood.
>
> Instagram and Venmo are written in django, which is proof that it can be
> scaled with the rest of the big players in the industry.
>
> There are certainly problems with scaling python and Django, a perfect
> language/framework doesn’t exist, but there are benefits to both python and
> Django that can be worth the tradeoff.
>
> In addition to the fact that both Django and python are so flexible and
> stay up to date with modern trends as well as any of their competitors, I
> always suggest learning them compared to the other options out there. Just
> don’t let python get in the way of writing good code, because as a beginner
> it’s really easy to forget best practices with it.
>
> Sent from my iPhone
>
> On Nov 14, 2018, at 6:46 PM, Arturo Fernandez  wrote:
>
> Thanks :)
>
> On Wednesday, November 14, 2018 at 9:41:35 PM UTC-5, Ryan Gedwill wrote:
>>
>> I live in the SF Bay Area and there are no shortage of jobs in Django. It
>> is true there are also plenty of jobs in Node, but you can’t compare a
>> framework to a backend language. I see far more python jobs than node jobs.
>>
>> 2 things to keep in mind though (for reference I’m a python/Django dev
>> but have experience in node and c# as well):
>>
>> 1. Just because something is very popular doesn’t mean it’s the easiest
>> to get a job in. There may be more python/JS jobs out there, but there are
>> also way more people applying to them. There are plenty of .NET jobs out
>> there, and far less entry level developers who are looking for them. Nearly
>> every single entry level developer is looking for those python/JS jobs
>> 2. Often times the language and framework you’re experienced in doesn’t
>> matter. I recently had an interview for a Go position, and I was allowed to
>> pick which language I wanted to do the interview in. Most web development
>> jobs are looking for your understanding of general software and web
>> development principles. If you understand html/css/js, sql databases in
>> regards to MVC architecture, MVC architecture itself, and REST API’s and
>> requests, it probably won’t matter what language as long as you can prove
>> it. Knowing the language and framework of the company you’re applying to is
>> kind of just brownie points and improves your chances. If I’m amazing at
>> django and web development but don’t know the language being used, I’ll
>> generally be chosen over someone who’s shaky on web development who uses
>> the same language as the company
>>
>> Sent from my iPhone
>>
>> On Nov 14, 2018, at 6:18 PM, Arturo Fernandez  wrote:
>>
>> Hello community, today someone at work told me to bare in mind which tech
>> I use in terms of profitability. As a backend language, there is no doubt
>> that I'll use Python, however I'm doubting about the framework, whether I
>> should use Python or not for web.
>> I heard that Django is kind of slow, and also there amount of jobs are
>> decreasing. Is that true? I initiated my web experience with Node.js, but I
>> don't want to continue it due to the instability. A friend recommend me
>> .Net, so I have all this kind of doubts in my head. Can someone help me
>> clear my mind? This is probably the best/not the best place to ask it but I
>> need some advice :/
>>
>> 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...@googlegroups.com.
>> To post to this group, send email to django...@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/df1cf01f-a911-493c-aca4-e5a6ac3931d1%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
> You received this message because you are subscribed to 

Re: Django jobs

2018-11-14 Thread Ryan Gedwill
No problem!

Also as a side note to the point that you heard django is slow...

Django is extremely scalable, which of course requires speed.  It’s probably 
the most popular web framework among startups of any magnitude (at least from 
what I’ve seen) by a mile. 

Django certainly may require some extra optimization compared to something like 
ASP.NET, just like scaling any python software, but there are ways around a lot 
of it that are well understood. 

Instagram and Venmo are written in django, which is proof that it can be scaled 
with the rest of the big players in the industry.

There are certainly problems with scaling python and Django, a perfect 
language/framework doesn’t exist, but there are benefits to both python and 
Django that can be worth the tradeoff.

In addition to the fact that both Django and python are so flexible and stay up 
to date with modern trends as well as any of their competitors, I always 
suggest learning them compared to the other options out there. Just don’t let 
python get in the way of writing good code, because as a beginner it’s really 
easy to forget best practices with it.

Sent from my iPhone

> On Nov 14, 2018, at 6:46 PM, Arturo Fernandez  wrote:
> 
> Thanks :)
> 
>> On Wednesday, November 14, 2018 at 9:41:35 PM UTC-5, Ryan Gedwill wrote:
>> I live in the SF Bay Area and there are no shortage of jobs in Django. It is 
>> true there are also plenty of jobs in Node, but you can’t compare a 
>> framework to a backend language. I see far more python jobs than node jobs.
>> 
>> 2 things to keep in mind though (for reference I’m a python/Django dev but 
>> have experience in node and c# as well):
>> 
>> 1. Just because something is very popular doesn’t mean it’s the easiest to 
>> get a job in. There may be more python/JS jobs out there, but there are also 
>> way more people applying to them. There are plenty of .NET jobs out there, 
>> and far less entry level developers who are looking for them. Nearly every 
>> single entry level developer is looking for those python/JS jobs
>> 2. Often times the language and framework you’re experienced in doesn’t 
>> matter. I recently had an interview for a Go position, and I was allowed to 
>> pick which language I wanted to do the interview in. Most web development 
>> jobs are looking for your understanding of general software and web 
>> development principles. If you understand html/css/js, sql databases in 
>> regards to MVC architecture, MVC architecture itself, and REST API’s and 
>> requests, it probably won’t matter what language as long as you can prove 
>> it. Knowing the language and framework of the company you’re applying to is 
>> kind of just brownie points and improves your chances. If I’m amazing at 
>> django and web development but don’t know the language being used, I’ll 
>> generally be chosen over someone who’s shaky on web development who uses the 
>> same language as the company
>> 
>> Sent from my iPhone
>> 
>>> On Nov 14, 2018, at 6:18 PM, Arturo Fernandez  wrote:
>>> 
>>> Hello community, today someone at work told me to bare in mind which tech I 
>>> use in terms of profitability. As a backend language, there is no doubt 
>>> that I'll use Python, however I'm doubting about the framework, whether I 
>>> should use Python or not for web. 
>>> I heard that Django is kind of slow, and also there amount of jobs are 
>>> decreasing. Is that true? I initiated my web experience with Node.js, but I 
>>> don't want to continue it due to the instability. A friend recommend me 
>>> .Net, so I have all this kind of doubts in my head. Can someone help me 
>>> clear my mind? This is probably the best/not the best place to ask it but I 
>>> need some advice :/
>>> 
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@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/df1cf01f-a911-493c-aca4-e5a6ac3931d1%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+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/df2eb30f-e34a-40d5-a356-f83850cd246a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the 

Re: Django jobs

2018-11-14 Thread Arturo Fernandez
Thanks :)

On Wednesday, November 14, 2018 at 9:41:35 PM UTC-5, Ryan Gedwill wrote:
>
> I live in the SF Bay Area and there are no shortage of jobs in Django. It 
> is true there are also plenty of jobs in Node, but you can’t compare a 
> framework to a backend language. I see far more python jobs than node jobs.
>
> 2 things to keep in mind though (for reference I’m a python/Django dev but 
> have experience in node and c# as well):
>
> 1. Just because something is very popular doesn’t mean it’s the easiest to 
> get a job in. There may be more python/JS jobs out there, but there are 
> also way more people applying to them. There are plenty of .NET jobs out 
> there, and far less entry level developers who are looking for them. Nearly 
> every single entry level developer is looking for those python/JS jobs
> 2. Often times the language and framework you’re experienced in doesn’t 
> matter. I recently had an interview for a Go position, and I was allowed to 
> pick which language I wanted to do the interview in. Most web development 
> jobs are looking for your understanding of general software and web 
> development principles. If you understand html/css/js, sql databases in 
> regards to MVC architecture, MVC architecture itself, and REST API’s and 
> requests, it probably won’t matter what language as long as you can prove 
> it. Knowing the language and framework of the company you’re applying to is 
> kind of just brownie points and improves your chances. If I’m amazing at 
> django and web development but don’t know the language being used, I’ll 
> generally be chosen over someone who’s shaky on web development who uses 
> the same language as the company
>
> Sent from my iPhone
>
> On Nov 14, 2018, at 6:18 PM, Arturo Fernandez  > wrote:
>
> Hello community, today someone at work told me to bare in mind which tech 
> I use in terms of profitability. As a backend language, there is no doubt 
> that I'll use Python, however I'm doubting about the framework, whether I 
> should use Python or not for web. 
> I heard that Django is kind of slow, and also there amount of jobs are 
> decreasing. Is that true? I initiated my web experience with Node.js, but I 
> don't want to continue it due to the instability. A friend recommend me 
> .Net, so I have all this kind of doubts in my head. Can someone help me 
> clear my mind? This is probably the best/not the best place to ask it but I 
> need some advice :/
>
> 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...@googlegroups.com .
> To post to this group, send email to django...@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/df1cf01f-a911-493c-aca4-e5a6ac3931d1%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+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/df2eb30f-e34a-40d5-a356-f83850cd246a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sending PDF from javascript to django

2018-11-14 Thread Joel Mathew
Thank you. I decided to go with reportlab since it seems to be really
powerful and doesnt require a headless browser. The options it has seem
similiar (at least superficially) to the way I'm coding js in pdfjs. Thank
you for your input. This was a XY problem after all. I should never have
thought about generating PDF on client and then uploading to server to
email the enduser.

Sincerely yours,

Joel G Mathew



On Wed, 14 Nov 2018 at 20:10, Matthew Pava  wrote:

> There is django-hardcopy.
>
>
>
> However, I’m in process of changing my PDF generation algorithm.  I
> originally used PhantomJS with gs-print and gs-view for Windows.
> Unfortunately, PhantomJS has been discontinued, and it wasn’t taking
> advantage of rendering changes to HTML (especially for printing or PDF
> generation) that had developed over the years, especially with Google
> Chrome’s Blink engine, which used to formerly be Webkit, the same engine
> that PhantomJS was using.  My current goal is to utilize headless Chrome
> with Puppeteer, which is a NodeJS package.  Since PhantomJS was a NodeJS
> package, too, it shouldn’t be to involved to get a script working for
> Puppeteer.  And then I am guaranteed to always have the latest version of
> Chrome.
>
>
>
> *From:* django-users@googlegroups.com [mailto:
> django-users@googlegroups.com] *On Behalf Of *Joel
> *Sent:* Wednesday, November 14, 2018 8:07 AM
> *To:* django-users@googlegroups.com
> *Subject:* Re: Sending PDF from javascript to django
>
>
>
> Ideally I would love to generate the pdf on the server. Hovered I am yet
> to discover an easy way to create a pdf easily with the ease of jspdf's
> table plugin.
>
>
>
> Perhaps someone can shed light on a good python library to do this without
> much ado.
>
>
>
> On Wed, 14 Nov, 2018, 7:12 PM Jason 
> your original error was due to exceding django's max upload size.  check
> out
> https://docs.djangoproject.com/en/2.1/ref/settings/#data-upload-max-memory-size
>
>
>
> also, you should check out https://djangopackages.org/grids/g/pdf/
>
>
>
> What I would do is generate the pdf in the view from a rendered template
> and then send from email.  No need to generate it on the client and upload
> for an email.
>
> --
> 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/506231af-2c44-4e8c-9c9d-36d8ea913b7b%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+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/CAA%3Diw_9QAr_Y2deWgjsXmZcmM8HALA3Gg0jDz_dZVtnSt9Vtog%40mail.gmail.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+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/95f81d5cad9e4abb87af8d794ca745e6%40iss2.ISS.LOCAL
> 
> .
> 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+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/CAA%3Diw_-0XNe%3DmRQwXFkneTzMUcjNr3NHEMoxXZtzhovcKDgvvw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django jobs

2018-11-14 Thread Ryan Gedwill
I live in the SF Bay Area and there are no shortage of jobs in Django. It is 
true there are also plenty of jobs in Node, but you can’t compare a framework 
to a backend language. I see far more python jobs than node jobs.

2 things to keep in mind though (for reference I’m a python/Django dev but have 
experience in node and c# as well):

1. Just because something is very popular doesn’t mean it’s the easiest to get 
a job in. There may be more python/JS jobs out there, but there are also way 
more people applying to them. There are plenty of .NET jobs out there, and far 
less entry level developers who are looking for them. Nearly every single entry 
level developer is looking for those python/JS jobs
2. Often times the language and framework you’re experienced in doesn’t matter. 
I recently had an interview for a Go position, and I was allowed to pick which 
language I wanted to do the interview in. Most web development jobs are looking 
for your understanding of general software and web development principles. If 
you understand html/css/js, sql databases in regards to MVC architecture, MVC 
architecture itself, and REST API’s and requests, it probably won’t matter what 
language as long as you can prove it. Knowing the language and framework of the 
company you’re applying to is kind of just brownie points and improves your 
chances. If I’m amazing at django and web development but don’t know the 
language being used, I’ll generally be chosen over someone who’s shaky on web 
development who uses the same language as the company

Sent from my iPhone

> On Nov 14, 2018, at 6:18 PM, Arturo Fernandez  wrote:
> 
> Hello community, today someone at work told me to bare in mind which tech I 
> use in terms of profitability. As a backend language, there is no doubt that 
> I'll use Python, however I'm doubting about the framework, whether I should 
> use Python or not for web. 
> I heard that Django is kind of slow, and also there amount of jobs are 
> decreasing. Is that true? I initiated my web experience with Node.js, but I 
> don't want to continue it due to the instability. A friend recommend me .Net, 
> so I have all this kind of doubts in my head. Can someone help me clear my 
> mind? This is probably the best/not the best place to ask it but I need some 
> advice :/
> 
> 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+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/df1cf01f-a911-493c-aca4-e5a6ac3931d1%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+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/E8F0EA6E-0AEC-48A8-969D-863925901EC2%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why I can't pass anything to my html? Django 2.1

2018-11-14 Thread Rookies DJ
Hi Amit pant

I'm sorry how do that (make dictionary for display variables using html)

Maybe you could give me some sample code?



On Monday, 12 November 2018 23:39:26 UTC+8, amit pant wrote:
>
> you need to make dictionary for display variables using html
>
> On Mon, Nov 12, 2018 at 6:57 PM Cuneyt Mertayak  > wrote:
>
>> vvv Typo: read "context" instead of "content" vvv
>>
>> On Monday, November 12, 2018 at 5:26:48 AM UTC-8, Cuneyt Mertayak wrote:
>>>
>>> The content for the `render` method is supposed to be a dictionary: 
>>> https://docs.djangoproject.com/en/2.1/topics/http/shortcuts/#optional-arguments
>>>
>>> So change it to this render(requset, "FrounterWeb/body.html",{'tank': 
>>> tank})
>>>
>>> Also in the template file you want to display the properties of the ORM 
>>> (tank_system) object I guess, change them to {{tank.EC}}, 
>>> {{tank. temp}}, respectively.
>>>
>>> Hope it helps!
>>>
>>> On Monday, November 12, 2018 at 4:13:21 AM UTC-8, Rookies DJ wrote:

 I been trying 2 weeks on trying to pass variables form Django views 
 into html, but every time I run my code, it works but it doesn't display 
 the variable I see 

 from django.shortcuts import render
 from zigview.models import tank_system

 def index(request):
 return render(request,'FrounterWeb/includes.html')

 def login(requset):
 return render(requset, 'FrounterWeb/login.html')


 def timedex(requset):
 tank = tank_system.object.get(id(5))
 print(tank)
 return render(requset, "FrounterWeb/body.html",tank)


 Here my models

 from django.db import models


 class user(models.Model):
 username = models.CharField(max_length=50)
 password = models.CharField(max_length=50)


 class tank_system(models.Model):
 Ph = models.DecimalField(max_digits=2, decimal_places=1)
 EC = models.DecimalField(max_digits=2, decimal_places=1)
 temp = models.DecimalField(max_digits=2, decimal_places=0)
 level = models.IntegerField(primary_key=True, default=0)
 data = models.DateTimeField(auto_now=True)


 Here my HTML that i try pass variable in 

 
 
   Time
   Tank level
   EC
   pH
   room temptures
   Water temptrure
 
 
   22.30
   900 lits
   {{tank}}
   7.3
   {{tank}}
   24
 

 


 My HTML body structures

 Web

 ├── templates
 │   ├── index.hmtl
 │   │   └── includes
 │   ├── body.hml
 │   ├── header.html

   This my urls files;

 from django.contrib import admin
 from django.urls import include, path
 from django.views.generic.base import TemplateView

 urlpatterns = [
 path(r'^admin/$', admin.site.urls),
 path('account', include('django.contrib.auth.urls')),
 path('', include('zigview.urls')),
 path(r'', TemplateView.as_view(template_name='index.html'), name = 
 'myapp'),
 ]

 -- 
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/0ccdcf5d-1d90-41e4-be33-f3684dace2b1%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+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/b6acf5ff-b2cb-4769-bdf0-67e7b5104bcc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django jobs

2018-11-14 Thread Arturo Fernandez
Hello community, today someone at work told me to bare in mind which tech I 
use in terms of profitability. As a backend language, there is no doubt 
that I'll use Python, however I'm doubting about the framework, whether I 
should use Python or not for web. 
I heard that Django is kind of slow, and also there amount of jobs are 
decreasing. Is that true? I initiated my web experience with Node.js, but I 
don't want to continue it due to the instability. A friend recommend me 
.Net, so I have all this kind of doubts in my head. Can someone help me 
clear my mind? This is probably the best/not the best place to ask it but I 
need some advice :/

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+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/df1cf01f-a911-493c-aca4-e5a6ac3931d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels + django-tenants

2018-11-14 Thread Andrew Godwin
Hm, that's not sufficiently better than just supplying a new middleware to
be honest. The sort of hooks I prefer are where you can subclass and
improve what we ship with and give the user a new, non-fragile one, whereas
that just sounds like it's injecting a function in.

Honestly, given Channels is currently only one maintainer, any increase in
surface area is unlikely unless there's a very good reason. Channels' auth
stuff is just standard Django code + settings for the most part, so there's
already bits you can reuse to do most of the work.

Andrew

On Tue, Nov 13, 2018 at 3:00 PM  wrote:

> I know this is not general, but maybe `get_user` could accept an optional
> function as second parameter, so that the function could wrap the inner
> content of the current `get_user`. django-tenants provides a regular
> middleware, but I think the async breaks any attempt to handle this through
> a channels-like middleware.
>
> --
> 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/f99a231f-cdc5-426f-8d0a-20c0f8ebc2fc%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+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/CAFwN1uor2Y0xdzogVEgZLM54qRrnuDAuKaN3T_5YkOO5nZCt3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Bokeh Server via Django Tutorial

2018-11-14 Thread Kirubel Tadesse
Hi Jonathan
Could you please explain to me where you are starting the bokeh server I 
see that you are creating a session. I tried to the same thing I keep on 
getting an error message. I just want to understand how you are starting 
the Bokeh server and if there is a way to know if bokeh serve has been 
started or not?

[image: Error.PNG] 

Thank you for sharing this tutorial it is really helpful!


On Wednesday, November 8, 2017 at 12:11:54 PM UTC-5, Jonathan Bennett wrote:
>
> I created a tutorial that demonstrates how to create and host a Django 
> Website that serves interactive Bokeh Server plots.
>
> The github repository is here:
> https://github.com/KonoAnalytics/BokehDjango
>
> The website is here, although I don't intend to keep this up permanently:
> http://45.33.6.39/
>
> Please consider taking it for a spin and giving me any feedback you may 
> have.
>
> Thanks,
> Jonathan
>
> -- 
>
> Jonathan Bennett
> Kono Analytics
> p: 713.489.4338
> w: konoanalytics.com
>   
>   
>     
> 
>
>

-- 
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/7d52ba2e-4a10-4bd1-9a71-250b5a682c79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Backend for django-cache using dynamodb

2018-11-14 Thread Ezequiel Bertti
Hi,

I was thinking of using dynamodb as a django cache backend. But I did not
find any lib.

What do you think about this idea?

-- 
Ezequiel Bertti

https://telegram.me/ebertti
https://twitter.com/ebertti
https://github.com/ebertti

-- 
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/CACrQMYqRLXuthe8Vqqu-zRguT0uu1Qbyu%2BT0dMcSoJUqH4fCcw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do I store details securely with django?

2018-11-14 Thread Lance Haig

Hi Dev,

I believe that it would not provide much more security around the details.

Thank you for responding.


Regards

Lance


On 11/13/18 4:55 AM, Devender Kumar wrote:

Hi
Study about LDAP protocol
Regards
Dev

On Tue 13 Nov, 2018, 4:06 AM PASCUAL Eric  wrote:


Hi Lance,


Well, I was off topic. Sorry for this :/ I understand your need
better now.


There are chances you've already thought to this option, but what
about storing the sensitive data encrypted with a key based on a
passphrase the user must provide when logging, in addition to the
usual credentials ? This passphrase would not be stored anywhere,
so even if the DB is compromised, the sensitive data would not be
usable.


Eric


*From:* django-users@googlegroups.com

mailto:django-users@googlegroups.com>> on behalf of Lance Haig
mailto:lnh...@gmail.com>>
*Sent:* Monday, November 12, 2018 4:45:50 PM
*To:* django-users@googlegroups.com

*Subject:* Re: How do I store details securely with django?

Hi Eric,


I am sure I have not explained myself properly.

The app does the following.

It presents a user the ability to sign up to a cloud platform for
a sandbox / playground account.
The number of cloud services that are available will change over time.

Each cloud platform has a set of credentials (username, password,
domain etc...) These credentials will have elevated permissions
within their own environments and so should be kept as safe as
possible.

Currently I use secrets and .env files to provide these credentials.
This requires physical access to the platform to add new secrets
etc...

I want to enable editing (e.g. CRUD on the platform credentials)
without having to redeploy the application or update the secrets.
The idea was to enable an admin interface to the DB so that each
cloud platform admin could add more or delete their platform from
the solution.
This requires a place to store secrets that can be updated deleted
and created.
I was hoping that there might be a standard way to store these
that is secure other than adding secrets or updating the .env file.

Thanks for trying to understand my vague question.

Lance



On 11/12/18 10:04 AM, PASCUAL Eric wrote:


Hi Lance,


 but I need for people who are admins for a particular cloud to
add their cloud details to the app and then store their
credentials securely.


I'm not sure to understand the need for adding cloud details to
the app for the admins.


The suggestion I made assumed that sensitive information is
managed as K8S secrets. As long as the admins have GCloud (for
instance) credentials set (which are stored and managed at GCloud
level), they can administrate the secrets resources by "applying"
the corresponding YAML descriptors remotely from their
workstation. The sensitive values are thus stored nowhere inside
the application itself, but passed to the containers at runtime
as environment variables.


Maybe I've misunderstood your need and sorry in this case if my
answer is off topic.


Best


Eric


*From:* django-users@googlegroups.com


 on behalf of Lance Haig
 
*Sent:* Monday, November 12, 2018 9:07:30 AM
*To:* django-users@googlegroups.com

*Subject:* Re: How do I store details securely with django?

Hi Eric,


Thanks for the response.


This idea has an end goal of being deployed in a resilient way so
most probably docker with some form of orchestration, Docker
swarm or Kubernetes.


The credentials are mainly stored in a .env file at the moment
and could be added to the secrets but I need for people who are
admins for a particular cloud to add their cloud details to the
app and then store their credentials securely.


Unfortunately this will need a dynamic storage mechanism which i
don't know how to do yet


Regards


Lance



On 11/12/18 12:03 AM, PASCUAL Eric wrote:


Hi,


It can depend on which deployment option you plan to use for the
application.


For instance, a Docker deployment orchestrated by Kubernetes
gives the option of using secrets for sensitive information,
which a hoster such as GCP manages conveniently. In this kind of
deployment, configuration (and secrets) are passed to the app as
environment variables, on which Kubernetes configuration maps
and secrets are mapped to. Thanks to this, values 

Re: How do I store details securely with django?

2018-11-14 Thread Lance Haig

Thanks Eric,


I did not explain myself properly so the mistake was mine.


Thanks for the help.


Lance


On 11/12/18 11:35 PM, PASCUAL Eric wrote:


Hi Lance,


Well, I was off topic. Sorry for this :/ I understand your need better 
now.



There are chances you've already thought to this option, but what 
about storing the sensitive data encrypted with a key based on a 
passphrase the user must provide when logging, in addition to the 
usual credentials ? This passphrase would not be stored anywhere, so 
even if the DB is compromised, the sensitive data would not be usable.



Eric


*From:* django-users@googlegroups.com  
on behalf of Lance Haig 

*Sent:* Monday, November 12, 2018 4:45:50 PM
*To:* django-users@googlegroups.com
*Subject:* Re: How do I store details securely with django?

Hi Eric,


I am sure I have not explained myself properly.

The app does the following.

It presents a user the ability to sign up to a cloud platform for a 
sandbox / playground account.

The number of cloud services that are available will change over time.

Each cloud platform has a set of credentials (username, password, 
domain etc...) These credentials will have elevated permissions within 
their own environments and so should be kept as safe as possible.


Currently I use secrets and .env files to provide these credentials.
This requires physical access to the platform to add new secrets etc...

I want to enable editing (e.g. CRUD on the platform credentials) 
without having to redeploy the application or update the secrets.
The idea was to enable an admin interface to the DB so that each cloud 
platform admin could add more or delete their platform from the solution.
This requires a place to store secrets that can be updated deleted and 
created.
I was hoping that there might be a standard way to store these that is 
secure other than adding secrets or updating the .env file.


Thanks for trying to understand my vague question.

Lance



On 11/12/18 10:04 AM, PASCUAL Eric wrote:


Hi Lance,


 but I need for people who are admins for a particular cloud to add 
their cloud details to the app and then store their credentials securely.



I'm not sure to understand the need for adding cloud details to the 
app for the admins.



The suggestion I made assumed that sensitive information is managed 
as K8S secrets. As long as the admins have GCloud (for instance) 
credentials set (which are stored and managed at GCloud level), they 
can administrate the secrets resources by "applying" the 
corresponding YAML descriptors remotely from their workstation. The 
sensitive values are thus stored nowhere inside the application 
itself, but passed to the containers at runtime as environment variables.



Maybe I've misunderstood your need and sorry in this case if my 
answer is off topic.



Best


Eric


*From:* django-users@googlegroups.com 
 
 
 on behalf of Lance Haig 
 

*Sent:* Monday, November 12, 2018 9:07:30 AM
*To:* django-users@googlegroups.com 


*Subject:* Re: How do I store details securely with django?

Hi Eric,


Thanks for the response.


This idea has an end goal of being deployed in a resilient way so 
most probably docker with some form of orchestration, Docker swarm or 
Kubernetes.



The credentials are mainly stored in a .env file at the moment and 
could be added to the secrets but I need for people who are admins 
for a particular cloud to add their cloud details to the app and then 
store their credentials securely.



Unfortunately this will need a dynamic storage mechanism which i 
don't know how to do yet



Regards


Lance



On 11/12/18 12:03 AM, PASCUAL Eric wrote:


Hi,


It can depend on which deployment option you plan to use for the 
application.



For instance, a Docker deployment orchestrated by Kubernetes gives 
the option of using secrets for sensitive information, which a 
hoster such as GCP manages conveniently. In this kind of deployment, 
configuration (and secrets) are passed to the app as environment 
variables, on which Kubernetes configuration maps and secrets are 
mapped to. Thanks to this, values are stored nowhere in the app 
code, companion files or database.



Regards


Eric


*From:* django-users@googlegroups.com 
 
 
 on behalf of Mike Dewhirst 
 

*Sent:* Sunday, November 11, 2018 11:07:14 PM
*To:* django-users@googlegroups.com 


*Subject:* Re: How do I store details securely with django?
On 12/11/2018 12:47 AM, Lance Haig wrote:
> Hi,
>
> I have a project I am working on 

Re: How do I store details securely with django?

2018-11-14 Thread Lance Haig

Thanks I will take a look at that


Lance


On 11/13/18 6:29 AM, Mike Dewhirst wrote:

Another thought

Django admin has a built-in mechanism for password management. It 
includes forms with password widgets.Perhaps you could hack your own 
encryption of the cloud credentials based on the Django approach to 
passwords.


It is possible to add forms to the Admin and include your own logic. I 
have done that - without the extra credentials part - to create 
additional data based on converting a @domain added to a username into 
a company name and company profile.


Mike

On Monday, November 12, 2018 at 12:47:56 AM UTC+11, Lance Haig wrote:

Hi,

I have a project I am working on https://github.com/lhaig/usery/
 and
part of the roadmap of the project is to add more cloud types to
the list.

I wanted to allow admins for these services to login and create
records
for their different clouds in the DB and then use these when people
request access to these services.

I need to find a secure way to store these credentials so that
even if
the DB is compromised that the credentials are safe.

Does anyone have suggestions on how I can accomplish this?

I would really appreciate some advice.

Regards

Lance



--
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/df4e7fc2-cf4d-4742-9fd3-adc1e7d037c6%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+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/6a2b4ee0-8948-67e4-51b8-87bf3d268056%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


RE: Sending PDF from javascript to django

2018-11-14 Thread Matthew Pava
There is django-hardcopy.

However, I’m in process of changing my PDF generation algorithm.  I originally 
used PhantomJS with gs-print and gs-view for Windows.  Unfortunately, PhantomJS 
has been discontinued, and it wasn’t taking advantage of rendering changes to 
HTML (especially for printing or PDF generation) that had developed over the 
years, especially with Google Chrome’s Blink engine, which used to formerly be 
Webkit, the same engine that PhantomJS was using.  My current goal is to 
utilize headless Chrome with Puppeteer, which is a NodeJS package.  Since 
PhantomJS was a NodeJS package, too, it shouldn’t be to involved to get a 
script working for Puppeteer.  And then I am guaranteed to always have the 
latest version of Chrome.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Joel
Sent: Wednesday, November 14, 2018 8:07 AM
To: django-users@googlegroups.com
Subject: Re: Sending PDF from javascript to django

Ideally I would love to generate the pdf on the server. Hovered I am yet to 
discover an easy way to create a pdf easily with the ease of jspdf's table 
plugin.

Perhaps someone can shed light on a good python library to do this without much 
ado.

On Wed, 14 Nov, 2018, 7:12 PM Jason 
mailto:jjohns98...@gmail.com> wrote:
your original error was due to exceding django's max upload size.  check out 
https://docs.djangoproject.com/en/2.1/ref/settings/#data-upload-max-memory-size

also, you should check out https://djangopackages.org/grids/g/pdf/

What I would do is generate the pdf in the view from a rendered template and 
then send from email.  No need to generate it on the client and upload for an 
email.
--
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/506231af-2c44-4e8c-9c9d-36d8ea913b7b%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+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/CAA%3Diw_9QAr_Y2deWgjsXmZcmM8HALA3Gg0jDz_dZVtnSt9Vtog%40mail.gmail.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+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/95f81d5cad9e4abb87af8d794ca745e6%40iss2.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


How to get multiple values from a template and update multiple fields in a rows of thesame table in django

2018-11-14 Thread AI
I am working on a result processing website and I've been trying to update 
multiple fields in each row of table. User should be able to input updated 
CA Score and EXAM Score values and it should update each student's CA Score 
and EXAM Score values which has been submitted. image of my page 


Someone ask same question here 

 
trying to update a single field. I tried to work with the solution provided 
there but was unable to make it suit my need

template

 {% csrf_token %}
{% for student in students %}

  {{ student.id_number }}
  
   
  
  
   
  

{% endfor %}

  







view


def add_score_for(request, id):
if request.method == 'GET':
students = TakenCourse.objects.filter(
course__allocated_course__lecturer__pk=request.user.id).filter(course__id=id
)
context = { "students":students}
return render(request, 'result/add_score_for.html', context)

if request.method == 'POST':
data = request.POST.dict()
data.pop('csrfmiddlewaretoken', None)
for i in data.items():
obj = TakenCourse.objects.get(id=i[0].split("_")[1])
if not str(obj.ca) == str(i[1]): # if i do i[2] trying to 
get for exams it raise 'tuple index out of range'
obj.ca = i[1]
obj.save()




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+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/7d33f35e-371e-434d-9eaa-0116792af7e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to get multiple values from a template and update multiple fields in a rows of thesame table in django

2018-11-14 Thread AI
I am working on a result processing website and I've been trying to update 
multiple fields in each row of table. User should be able to input updated 
CA Score and EXAM Score values and it should update each student's CA Score 
and EXAM Score values which has been submitted. image of page 


Someone ask same question here 

 
trying to update a single field. I tried to work with the solution provided 
there but was unable to make it suit my need

template

 {% csrf_token %}
{% for student in students %}

  {{ student.id_number }}
  
   
  
  
   
  

{% endfor %}

  







view

def add_score_for(request, id):
if request.method == 'GET':
students = TakenCourse.objects.filter(
course__allocated_course__lecturer__pk=request.user.id).filter(course__id=id
)
context = { "students":students}
return render(request, 'result/add_score_for.html', context)

if request.method == 'POST':
data = request.POST.dict()
data.pop('csrfmiddlewaretoken', None)
for i in data.items():
obj = TakenCourse.objects.get(id=i[0].split("_")[1])
if not str(obj.ca) == str(i[1]): # if i do i[2] trying to 
get for exams it raise 'tuple index out of range'
obj.ca = i[1]
obj.save()

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+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/0db4c048-f712-4a3d-9670-abe5dbca3d56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


using permission required

2018-11-14 Thread Akash utreja
I am trying to use permission required decorator using authorization 
header.And it always gives me 302 error. although my user has permission 
for it.Kindly help I am beginner to django.
Here is my code

@permission_required('access_admin', login_url=None)
@permission_classes((IsAuthenticated,))
@api_view(['POST','GET'])
def actionLibrary(request):
if request.method == 'GET':
print(request.user.has_perm("api.access_admin")) #it print true if 
I remove permission_required decorator
queryset=ActionLibrary.objects.all()
serializer=ActionLibrarySerailizer(queryset,many=True)
return Response(serializer.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+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/7952f118-107c-489b-a9e0-a94cc3441337%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is Django REST framework a part of Django?

2018-11-14 Thread Yarving Liu
You can treat DRF as a Django package, though it's not a part of django.

DRF is the best RESTFul framework I've ever seen, and with great
integration with Django.

On Mon, Nov 12, 2018 at 8:13 PM Bill Watkins  wrote:

> Good day,
>
> I've read an article about Django REST framework, and have a question: is
> this framework a part of Django?
> I'm actually going to use it only for REST, cause we are using
> microservices architecture, and UI container is a separate part.
> Is it good idea? What do you think?
>
> 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/d041ab7b-b926-4071-affe-0859cea5b48a%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+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/CAMNWVFohPMrgcZk9ZNy4OLhZ-sfTgT4j48M59bfKME_DZq6%3Dxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


about unique_together

2018-11-14 Thread 胡超



class QdProjectAssist(models.Model):
'''
页面推荐
'''
# id = models.AutoField('主键', primary_key=True)
project_id = models.ForeignKey('QdProject', verbose_name='项目', 
on_delete=models.CASCADE)
assist_id = models.ForeignKey('QdAssist', verbose_name='正文', 
on_delete=models.CASCADE)
sort = models.PositiveIntegerField('排序', blank=True, null=True)
addtime = models.PositiveIntegerField('添加时间')
uptime = models.DateTimeField('更新时间', auto_now=True)

class Meta:
managed = False
db_table = 'qd_project_assist'
unique_together = ('project_id', 'assist_id')
verbose_name = '页面推荐'
verbose_name_plural = verbose_name


I export the table with two primary keys from mysql.

Reporting errors in the course of use


django.db.utils.InternalError: (1054, "Unknown column 'qd_project_assist.id' in 
'field list'")

-- 
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/117bd094-09bd-429c-a289-0074de2374f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sending PDF from javascript to django

2018-11-14 Thread Joel
Ideally I would love to generate the pdf on the server. Hovered I am yet to
discover an easy way to create a pdf easily with the ease of jspdf's table
plugin.

Perhaps someone can shed light on a good python library to do this without
much ado.

On Wed, 14 Nov, 2018, 7:12 PM Jason  your original error was due to exceding django's max upload size.  check
> out
> https://docs.djangoproject.com/en/2.1/ref/settings/#data-upload-max-memory-size
>
> also, you should check out https://djangopackages.org/grids/g/pdf/
>
> What I would do is generate the pdf in the view from a rendered template
> and then send from email.  No need to generate it on the client and upload
> for an email.
>
> --
> 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/506231af-2c44-4e8c-9c9d-36d8ea913b7b%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+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/CAA%3Diw_9QAr_Y2deWgjsXmZcmM8HALA3Gg0jDz_dZVtnSt9Vtog%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sending PDF from javascript to django

2018-11-14 Thread Jason
your original error was due to exceding django's max upload size.  check 
out 
https://docs.djangoproject.com/en/2.1/ref/settings/#data-upload-max-memory-size

also, you should check out https://djangopackages.org/grids/g/pdf/

What I would do is generate the pdf in the view from a rendered template 
and then send from email.  No need to generate it on the client and upload 
for an email.

-- 
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/506231af-2c44-4e8c-9c9d-36d8ea913b7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to solve django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server during query')?

2018-11-14 Thread Jason
also, you might want to update your mysqlclient package.  1.3.12 was 
released over a year ago, and 1.3.13 was pushed out late June of this year.

-- 
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/36a9c760-a39a-43b0-bdb7-3b225737ac57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to solve django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server during query')?

2018-11-14 Thread Jason
just checking, but did you restart the mysql server after setting that 
max_allowed_packet setting?  It won't stick without a restart.


-- 
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/046dfeea-e16c-4f1f-8268-fad4d099b3d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to solve django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server during query')?

2018-11-14 Thread prateek gupta
Hi All,

I am using Django 2.0.6, Python 3.6. For connecting with Mysql 5.7 I am 
using mysqlclient 1.3.12.
Using above environment I have created an admin panel for CRUD operations.
When I select a tabel for viewing it's content following error shows-

django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server 
during query')

The above error comes only for one table, rest all are working fine.

I tried to set the max_allowed_packet=67108864 in mysql configuration file 
and in settings.py I have set the CONN_MAX_AGE=6000 but it is not working.

Have anyone faced the same issue?
Let me know if anyone knows how to solve this.

Thanks,
Prateek

-- 
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/26050b0b-164e-41d1-bd25-7a5d5c29f003%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sending PDF from javascript to django

2018-11-14 Thread Joel Mathew
I tried the following:

def myhandle_uploaded_file(f):
with open('some/file/name.txt', 'wb+') as destination:
for chunk in f.chunks():
destination.write(chunk)

def SendPrescriptionbyMail(request, cliniclabel, patient_id):
patient_id = int(patient_id)
if request.method == 'POST':
form = UploadFileForm(request.POST, request.FILES)
if form.is_valid():
myhandle_uploaded_file(request.FILES['file'])
return HttpResponseRedirect('/success/url/')

But I got the following error, which I cant make heads or tails of:

2018-11-14 15:16:49,585 django.request ERRORInternal Server Error:
/clinic/madhav/prescription/sendemail/patient/18
Traceback (most recent call last):
  File 
"/home/joel/myappointments/venv/lib/python3.6/site-packages/django/core/handlers/exception.py",
line 34, in inner
response = get_response(request)
  File 
"/home/joel/myappointments/venv/lib/python3.6/site-packages/django/utils/deprecation.py",
line 93, in __call__
response = self.process_response(request, response)
  File 
"/home/joel/myappointments/venv/lib/python3.6/site-packages/django/middleware/common.py",
line 105, in process_response
if response.status_code == 404:
AttributeError: 'str' object has no attribute 'status_code'

Sincerely yours,

Joel G Mathew
On Wed, 14 Nov 2018 at 14:45, Joel Mathew  wrote:
>
> I use jspdf to generate pdf for downloading by end users. I wish to
> add a function to let them send an email to themselves through the
> server.
> Reading a little bit, I've seen a method to send the pdf to the server
> as a base encoded string, and then have the server decode it, before
> emailing the object. It seems to be bad practise and a convoluted way,
> to me.
>
> Anyway, the javascript is doing this:
>
> var pdf = doc.output();
> cliniclabel = $("#TopPatientBar").data("cliniclabel")
> patient_id = $('body').find("#PatientIP").html();
> $.ajax({
> method: "POST",
> url: 
> `/clinic/${cliniclabel}/prescription/sendemail/patient/${patient_id}`,
> data: {data: pdf},
> }).done(function(data){
> console.log(data);
> });
>
> And as a preliminary step, I'm trying to read the POST data:
>
> def SendPrescriptionbyMail(request, cliniclabel, patient_id):
> patient_id = int(patient_id)
> if request.method == 'POST':
> print("POST data", request.POST)
> cus = customer.objects.get(cstid = patient_id)
> recipient=cus.email
>
> But I got this:
> [14/Nov/2018 14:39:27] "GET
> /appointments/static/appointments/js/popper.min.js.map HTTP/1.1" 404
> 1749
> [14/Nov/2018 14:39:30] "GET /clinic/medicines HTTP/1.1" 200 8389
> 2018-11-14 14:39:36,360 django.security.RequestDataTooBig ERROR
> Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.
> 2018-11-14 14:39:36,441 django.request WARNING  Bad Request:
> /clinic/madhav/prescription/sendemail/patient/18
> [14/Nov/2018 14:39:36] "POST
> /clinic/madhav/prescription/sendemail/patient/18 HTTP/1.1" 400 17930
>
> But rather than create an XY problem, can anyone tell me whether I'm
> approaching this in the right way? Isnt base encoding a pdf object
> from javascript for sending to django the wrong way to do this?
>
> What would be the right way? Just point me along what I need to be looking at.
>
> Sincerely yours,
>
> Joel G Mathew

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


Sending PDF from javascript to django

2018-11-14 Thread Joel Mathew
I use jspdf to generate pdf for downloading by end users. I wish to
add a function to let them send an email to themselves through the
server.
Reading a little bit, I've seen a method to send the pdf to the server
as a base encoded string, and then have the server decode it, before
emailing the object. It seems to be bad practise and a convoluted way,
to me.

Anyway, the javascript is doing this:

var pdf = doc.output();
cliniclabel = $("#TopPatientBar").data("cliniclabel")
patient_id = $('body').find("#PatientIP").html();
$.ajax({
method: "POST",
url: 
`/clinic/${cliniclabel}/prescription/sendemail/patient/${patient_id}`,
data: {data: pdf},
}).done(function(data){
console.log(data);
});

And as a preliminary step, I'm trying to read the POST data:

def SendPrescriptionbyMail(request, cliniclabel, patient_id):
patient_id = int(patient_id)
if request.method == 'POST':
print("POST data", request.POST)
cus = customer.objects.get(cstid = patient_id)
recipient=cus.email

But I got this:
[14/Nov/2018 14:39:27] "GET
/appointments/static/appointments/js/popper.min.js.map HTTP/1.1" 404
1749
[14/Nov/2018 14:39:30] "GET /clinic/medicines HTTP/1.1" 200 8389
2018-11-14 14:39:36,360 django.security.RequestDataTooBig ERROR
Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.
2018-11-14 14:39:36,441 django.request WARNING  Bad Request:
/clinic/madhav/prescription/sendemail/patient/18
[14/Nov/2018 14:39:36] "POST
/clinic/madhav/prescription/sendemail/patient/18 HTTP/1.1" 400 17930

But rather than create an XY problem, can anyone tell me whether I'm
approaching this in the right way? Isnt base encoding a pdf object
from javascript for sending to django the wrong way to do this?

What would be the right way? Just point me along what I need to be looking at.

Sincerely yours,

Joel G Mathew

-- 
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/CAA%3Diw_-5iVw_QnGy5hPft-%3DzAi8y5wkvuJ4QKAXRazhZaYgtjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.