bulk_update() causes Select N+1 issue

2023-01-13 Thread Nick Chang
Hi all,

I read django doc on 'bulk_update() 
<https://docs.djangoproject.com/en/4.1/ref/models/querysets/#bulk-update>'  
It said that generally it creates one single query to do so, but in a 
project I have has 'a_model.objects.bulk_update(update_list, 
fields=updated_keys), it actually generates N number of SELECT statements 
where N is the size of 'update_list'  This is being flagged as Select N+1 
bug.

Why did bulk_update() not generate a single query as it advertises? How 
would I fix this Select N+1 issue to increase the performance?

Kind Regards,

Nick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dc688786-e8db-4071-b1d3-13b2a17436bbn%40googlegroups.com.


Re: Move apps to different folders or to a root folder

2022-11-10 Thread Nick Chang
Hi Mike,

Thanks for your reply. To further clarify about `db_table` name regarding 
this vertical move. The 'db_table' field is actually already specified in 
the models. However, if the 'db_table' name were not specified in the model 
and let django handle generation table names, would this move break it?  
And it can be fixed by specifying the 'db_table" value in the moved models?

Thanks!

On Sunday, November 6, 2022 at 10:09:41 PM UTC-5 Mike Dewhirst wrote:

> On 7/11/2022 2:40 am, Nick Chang wrote:
>
> Hello community, 
>
> I am trying to organize my Django project's structure as the number of 
> apps is growing. So I am attempting to move an app in the sub-folder that 
> contains its model definitions. The app used to be named `<
> sub_folder_name>.foo <http://sub_folder_name%3E.foo/>` and now it will be 
> just named `foo` in the `LOCAL_APPS` setting.
>
> It seems straightforward to do this with the following two steps:
>
>1. Change the reference from `.foo 
><http://sub_folder_name%3E.foo/>` to `foo` in the whole project. 
>2. Do `mv foo ..` inside the sub-folder. 
>
> Is there any DB migration work that this move requires? Or since the app 
> name stays the same. There is nothing that needs to be done as Django does 
> not see any change in the models. So far my investigation confirms no DB 
> migration work is needed but would like to hear some experiences that folks 
> might have done before.
>
>
> Should work just fine.
>
> In any case, you can also specify the table name the model should use if 
> you do decide to switch models between apps ...
>
> class Meta:
>  app_label = "company"
>  db_table = "common_user"
>
> If your python code works and your tests pass everything should be fine. 
>
>
>
> 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...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/5ac5eea7-f620-4d11-9796-3439231939f3n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/5ac5eea7-f620-4d11-9796-3439231939f3n%40googlegroups.com?utm_medium=email_source=footer>
> .
>
>
>
> -- 
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9f355cfa-12ed-4e4b-86a5-7c5ee4c348c3n%40googlegroups.com.


Move apps to different folders or to a root folder

2022-11-06 Thread Nick Chang
Hello community,

I am trying to organize my Django project's structure as the number of apps 
is growing. So I am attempting to move an app in the sub-folder that 
contains its model definitions. The app used to be named `<
sub_folder_name>.foo ` and now it will be 
just named `foo` in the `LOCAL_APPS` setting.

It seems straightforward to do this with the following two steps:

   1. Change the reference from `.foo 
   ` to `foo` in the whole project.
   2. Do `mv foo ..` inside the sub-folder.

Is there any DB migration work that this move requires? Or since the app 
name stays the same. There is nothing that needs to be done as Django does 
not see any change in the models. So far my investigation confirms no DB 
migration work is needed but would like to hear some experiences that folks 
might have done before.

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5ac5eea7-f620-4d11-9796-3439231939f3n%40googlegroups.com.


Re: Django tutor.

2022-07-27 Thread nick washington
Cool

On Wed, Jul 27, 2022, 18:19 Md Aminul Haque 
wrote:

> Show Django Official website
>
> Sent from my Huawei phone
>
>
>  Original message 
> From: pediah wanmi 
> Date: Wed, Jul 27, 2022, 5:22 PM
> To: django-users@googlegroups.com
> Subject: Django tutor.
>
> I am a djongk intermediary, please can I
>  get a tutor?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABd3QauHU4wdePFvGsY3V-GSO8Ly37zMqgmcV2tyDV56Sw81Tw%40mail.gmail.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/dun4asa4bdzxtzjwj4-3qjf8j-urdlt42i1gaiz8sfaua9chke-albmexg650pjd8w9no-mjoqq4cguikj-bk51if-em08lf-jw7g21idl3xdyre5d8-v97n9i-lanxvz6om99w-w4oi0-dog49dbovagl.1658932720646%40email.android.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAETXisem7FDUpRd1VZt7kFu2VhdNp7XTUU0eLSAMJrhnFOv-Wg%40mail.gmail.com.


Re: HOW TO RUN DJANGO PROJECT

2022-07-22 Thread nick washington
How do you want my help

On Fri, Jul 22, 2022, 18:08 Edward Deus Misogoro 
wrote:

> Please help
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/af039f64-f2f6-4994-a33c-f519882dbb13n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAETXisckFSb%3DtS-BvfcFvwmT1%3Dtzz8OPAR22u2WOWrWa-YPuXQ%40mail.gmail.com.


Re: Is there a function that returns common elements in multiple lists

2022-01-26 Thread Nick Farrell
>>> a = {1, 2, 3}
>>> b = {2, 3, 4}
>>> a & b
{2, 3}
On Wednesday, 26 January 2022 at 23:52:05 UTC+11 xaadx...@gmail.com wrote:

> a = [1,2,3,4]
> b = [3,4,5,6]
>
> Convert list a to set
> a_set = set(a)
> print(a_set.intersection(b))
>
> On Wed, Jan 26, 2022, 5:47 PM Muhammad Shehzad  wrote:
>
>> Use intersection
>>
>> On Wed, Jan 26, 2022, 4:06 PM bnmng  wrote:
>>
>>> Thank you.  I think I'll go with sets as advised, although this method 
>>> also looks very neat: 
>>> intersection = [item for item in list1 if item in list2] found at 
>>> https://datagy.io/python-intersection-between-lists/ 
>>>
>>>  
>>>   
>>>
>>> On Tuesday, January 25, 2022 at 3:11:10 PM UTC-5 joezep...@gmail.com 
>>> wrote:
>>>


 On Tue, Jan 25, 2022 at 3:07 PM bnmng  wrote:

> Thank you.  That set.intersection with list conversion seems like the 
> way to go.  On your second point, well taken.  I'll keep that in mind for 
> future Python questions
>
> On Tuesday, January 25, 2022 at 7:46:58 AM UTC-5 bnmng wrote:
>
>> Hello,
>>
>> Is there a built in function that compares two or more lists and 
>> returns elements common to all?
>>
>> like this:
>>  
>> def in_both( list_a, list_b ):
>> list_c=[]
>> for value in list_a:
>> if value in list_b:
>> list_c.append(value)
>> return list_c
>>
>> Or this:
>> def in_all(list_of_lists):
>> list_a = list_of_lists.pop(0)
>> list_b = []
>> for value in list_a:
>> in_all_lists = True
>> for each_list in list_of_lists:
>> if not value in each_list:
>> in_all_lists = False
>> if in_all_lists:
>> list_b.append(value)
>> return list_b
>>
>> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/4465553d-8aa1-4ab2-9e9c-19c4117d623fn%40googlegroups.com
>  
> 
> .
>
 -- 
 Oussama Chafiqui

>>> -- 
>>> 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 view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/fc7b49a3-2ca2-48e1-8556-f742e16fa4c9n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/58190fe5-8839-4698-8db2-a20c0a928ab3n%40googlegroups.com.


Re: Eliminating inter-request race conditions

2022-01-08 Thread Nick Farrell
I thought I'd post a little update, as I'm fairly happy with my progress:

Here's the repo's readme. I haven't actually pushed the package to pypi so 
don't try to follow the instructions yet, but any feedback on the README's 
content is very welcome: 
https://github.com/nicois/nango/blob/develop/README.md . Hopefully in the 
next couple of days I'll push the package to pypi so anyone who's 
interested can make sure it works as advertised.

But still I wonder if client-side validation and feedback should be 
> optional? That is, if I had to do this myself, I'd hope to find a solution 
> first that works 100 % without client-side effects. This would also help a 
> lot with correctness and testing. Then I'd put all eye candy on top, but 
> keeping it strictly optional.


The client-side validation is latent in this release. That is, there is 
some code which will provide client-side validation with websockets, but it 
is disabled unless explicitly enabled in settings.py. I've put in the 
beginnings of some automated tests, which I can expand as I proceed. I 
agree that the server-side data integrity is more important, lower risk and 
easier to test.
 

> > There are only two ways I can see of to achieve this: use a full-blown 
> "rowversion" CAS pattern, where there is a dedicated monotonic column on 
> each table which automatically increases with each update, or the method I 
> propose/use, where the original form values are provided via the user agent 
> when the form is POSTed. 
>
> Then this would have to be temper-proof, wouldn't it? 
> (e.g. using https://itsdangerous.palletsprojects.com )

No, the (current) intention is not to make this tamper-proof. If you think 
about it, there is no value from trying to protect against an authenticated 
and authorised user who wants to submit incorrect values. While there could 
be HMACs etc, I don't see any value at all, as a malicious user does not 
need to tamper with the original values to submit bad data.
 

> It might even be possible to serialize the entire state of the object into 
> a single hidden field and sign it on GET, then check the signature and 
> deserialize on POST. Or maybe, depending on the exact requirements, even 
> the checksum of the old state would be enough in order to detect that 
> something changed between the old version of the model (as it was when the 
> user started editing it) and the current version (at the time the POST 
> request arrives). This would roughly correspond to a version number without 
> requiring an explicit field on the model.
>
Remember also that there is little to no value in checking that fields on 
the model have changed, if those fields are not shown on the model: firstly 
because the form will not update those fields in the database, and secondly 
because if only those "invisible" fields change, the end-user would see the 
same thing on the form, and would not alter their behaviour. 

The value here is in showing a user that one of the fields they are in the 
process of editing has changed while they have had the form open, and 
ensuring that they do not accidentally clobber someone else's changes.

Thanks for your feedback so far. 
 
Nick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a449bb5f-c834-457e-83f5-02eec2e0e784n%40googlegroups.com.


Re: Eliminating inter-request race conditions

2021-12-31 Thread Nick Farrell
Good to hear from you Carsten. Thanks in advance for your comments. I'll 
see what I can address now:

>
> > *2)* Not being able to safely lock a model/queryset beyond the lifetime 
> of the request. 
>
I don't quite understand this. It sounds like pessimistic locking?

Correct. To be clear, I am not advocating this behaviour by default, but 
making it as seamless as possible to enable when required, rather than 
needing to attempt to hand-roll safe locking semantics each time it's 
needed.
 

> > *3)* Not knowing that data has changed on the server until you submit a 
> form. 
> > *4)* Smarter form validation 
>
> Well, this comes at the cost of the complexity to implement this. For me, 
> at least at this time, the cost is much to high to consider this.
>
Certainly there is increased complexity. For the websites I am involved in 
(primarily health-related ones), if I don't end up providing a django-based 
solution, product owners end up demanding a SPA-based solution or similar, 
with the even-greater complexity to the development stack, not to mention 
testing. 

 

> > *The solutions* 
> > 
> > *Enhanced forms* 
> > - when rendering a form (using e.g. as_p()), alongside the normal INPUT 
> DOM elements, include additional hidden fields which store a copy of each 
> form field's initial value. 
>
> I don't think that having hidden fields with the initial values is 
> necessary: In your view, you can initialize the form like this: 
>
> if request.method == 'POST': 
> form = SomeForm(request.POST, initial=init) 
> ... 
>
> Note the `initial` parameter: It is used just as it is in the GET request. 
> This allows you to use `form.changed_data` and `form.has_changed()` in form 
> validation.

But where does "init" come from? How can you know what version of the model 
instance was shown to the user when the form was rendered? There are only 
two ways I can see of to achieve this: use a full-blown "rowversion" CAS 
pattern, where there is a dedicated monotonic column on each table which 
automatically increases with each update, or the method I propose/use, 
where the original form values are provided via the user agent when the 
form is POSTed. I guess a third option would be to cache the form values 
server-side using redis each time a form a served, and provide an ID to it, 
perhaps even using the CSRF token as the key.

Perhaps I am missing something - if there is a way to retrieve the initial 
value of the form automatically, I would love to use it.

Regarding formsets, the same applies, I agree it needs to support that, and 
by embedding the original values into each form in the formset, it should 
correctly respect those values when the formset is submitted. 

If it's of any assistance, I can push some code and provide some examples 
for you to try out. The same app I am using now should be quite easy to 
clone and evaluate. 

>
> Best regards, 
> Carsten

 
Gute Rutsch.

Nick 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cafc7989-44de-4035-88d1-c9d010946ed3n%40googlegroups.com.


"include super" with django templates?

2021-12-30 Thread Nick Farrell
I would like to extend a django template which is used via the include 
macro. That is, I want to add additional output before or after what would 
otherwise be emitted.

With the normal {% block %} syntax, it's easy to use super to follow the 
template heirachy similar to __mro__ - but to my knowledge there isn't an 
equivalent for include().

For example, form.as_p() calls render() with a template (by default, 
django/forms/p.html). I want my application to modify this, so whenever 
p.html is rendered, it is wrapped by my application's supplied template. 
(As I want this to work for any form instance, I cannot just override the 
default template name)

Another example is 
say django/forms/templates/django/forms/widgets/number.html. It consists of 
a single include() statement pointint to input.html. I would like to 
override input.html, but in a way which eventually renders the original 
template, in addition to my application's template.

Any suggestions?

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9ab15060-2dcd-44a0-abe3-eaeed8015813n%40googlegroups.com.


Re: Automatic subdomain for each user

2021-12-30 Thread Nick Farrell
Once you have the TLS certificates and routing working, can't you make a 
tiny piece of middleware which takes the hostname (provided via 
nginx/apache in a request header) and add an attribute on the request which 
corresponds to your virtual site?

e.g. (dodgy untested code follows):
def multisite_middleware(get_response): def middleware(request): 
domain_name = request.META.get('HTTP_HOST', DEFAULT_DOMAIN)
request.my_site = Site.objects.get(id=domain_name) response = 
get_response(request) return response return middleware

Then anywhere in your code you can access request.my_site for the 
site-specific data you need.

In addition, if you haven't already, take a look 
at https://docs.djangoproject.com/en/4.0/ref/contrib/sites/
On Friday, 31 December 2021 at 07:03:44 UTC+11 adigun...@gmail.com wrote:

> Thank you for your detailed response. Following your response point by 
> point with few additional googling, it works as expected.
>
> On cpanel:
> I created a subdomain called *
> Then I chose document root as the main Django root. (This is needed so 
> that letsencrypt can automatically create a certificate.)
>
> Then the routing works seemlessly
>
> Thank you
>
> On Thu, Dec 30, 2021, 7:06 PM Sherif Adigun  wrote:
>
>> Thank you very much for you guidance. I have been able to make it work 
>> using Django-hosts on my local. Still trying to fix it out to work on my 
>> shared hosting if possible
>>
>> On Thu, Dec 30, 2021, 10:29 AM Sherif Adigun  wrote:
>>
>>> Thank you @Tim.  Django subdomains looks promising but it's outdated. It 
>>> uses codes and imports of django< v2  I have checked django-hosts but it 
>>> looks as if it can be used  for only predefined list of subdomains. Please 
>>> help clarify this doubt.
>>>
>>> Thank you for your time
>>>
>>> On Thursday, December 30, 2021 at 1:10:17 AM UTC+1 Tim Chase wrote:
>>>
 On 2021-12-29 15:02, Sherif Adigun wrote: 
 > I am faced with a requirement where each user is required to use 
 > the application under his own subdomain. Whenever a user registers, 
 > he gets username.domain.com and he can add staff, manage reports, 
 > etc under his subdomain. 
 > 
 > What is the best approach to you can suggest please? 

 Generally this requires 

 1) configuring your DNS to allow for wildcard domains so that 
 *.domain.com points at your web server, usually looking something like 

 *.example.com. 3600 IN A 198.51.100.17 

 2) setting up your HTTPS certificates. This could be 

 - involve an ACME-aware Django route (I'm not sure if such a beast 
 exists) 

 - configuring an ACME client like certbot to update your 
 DNS records so that Let's Encrypt can verify that you own the 
 domain and then grant your a wildcard cert 

 - use a different CA to obtain a wildcard cert 

 2b) if you used a more manual method, put the certs in the 
 appropriate place for your web-server to pick them up 

 3) configure your web-server front-end/proxy (usually nginx or 
 Apache, but there are others) to handle the wildcard domains and pass 
 them through to your Django app or WSGI server or what have you. Make 
 sure the domain information is passed through in the HTTP_HOST header 

 4) use django-subdomains[1] (or maybe django-hosts[2]) middleware to 
 extract the intended host-name from the HTTP_HOST header and possibly 
 make the route reversable so that .reverse() works 

 5) check your views so that they make use of the HTTP_HOST 
 information to filter for user-specific information 

 -tkc 


 [1] https://django-subdomains.readthedocs.io/en/latest/ 


 [2] https://github.com/jazzband/django-hosts 





 -- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/django-users/CTynQlthabY/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> django-users...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/6057efaf-5e10-498a-ad2a-40132425412dn%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7cef164d-0f9c-4ad9-9d2d-18bfcb2d404bn%40googlegroups.com.


Re: Eliminating inter-request race conditions

2021-12-28 Thread Nick Farrell
Thanks for the reference Carsten.

I believe the approach I am taking, regarding optimistic locking, is 
superior to what is proposed in that thread. Specifically:
- there is no need for a special version field to be added to the model
- because forms only update specific fields in the associated model(s), 
there is no point in unnecessarily invalidating the form submission if 
unrelated model fields have been changed in the background; if a form does 
not show a field to begin with, having its value change would not alter the 
behaviour a person would make when editing the form.

Really I think this should be a code part of Django: just as you include 
CSRF protection virtually everywhere, you would be doing this. It is very 
rare that this feature would be undesired, and many Django developers will 
be getting burnt by the lack of CAS-like behaviour.

I'll continue to tinker with this either way, if only to use internally, if 
there isn't general interest.

cheers,

Nick.
On Tuesday, 28 December 2021 at 21:35:09 UTC+11 carste...@cafu.de wrote:

> Hi Nick,
>
> maybe this is a case for optimistic locking?
> Does the thread at 
> https://groups.google.com/d/msg/django-users/R7wJBTlC8ZM/MIzvYkWyCwAJ 
> help?
>
> Best regards,
> Carsten
>
>
> Am 27.12.21 um 06:36 schrieb Nick Farrell:
> > Hi all.
> > 
> > I've been using Django for quite a number of years now, in various ways. 
> Most of the time, I find myself needing to create custom solutions to solve 
> what appears to be a very common problem. 
> > 
> > During the Christmas downtime, I decided to scratch this itch, and am 
> putting together what will hopefully turn into a solution to what I'll 
> describe below. I'm writing this here to get a sense of what the Django 
> community sees in this: is this a niche problem, is it shared by a few 
> others, or is the lack of these features a fundamental overnight in the 
> core Django product?
> > 
> > *The problems *(from highest to lowest priority)*:*
> > *
> > *
> > *1)* a form is rendered, the data is changed by a different 
> task/request, then the form is submitted, overwriting the recent changes.
> > 
> > Whenever models can be modified by multiple users (or even the same user 
> in different windows/tabs of their browser), this can happen. Also, if 
> there are any background processes which can modify the data (e.g. celery, 
> or various data synchronisation services), it's possible.
> > In some situations this is no big deal, as the users do not really care, 
> or you know that the latest data would overwrite the previous data anyway. 
> But in general, this is a major risk, particularly when dealing with any 
> health or financial data. 
> > 
> > *2)* Not being able to safely lock a model/queryset beyond the lifetime 
> of the request.
> > 
> > This is related to problem 1, and solving problem 2 may in some 
> circumstances solve problem 1 - but not always. For example, depending on 
> how the lock is implemented, a "rogue" task/request may bypass the locking 
> mechanism and force a change to the underlying data. Also, if a lock is 
> based on a session, a user may have multiple tabs open in the same browser, 
> using the same session state (via shared cookies)
> > 
> > Solving this problem will reduce the chance that when a person does post 
> a form update, that there is any conflict, meaning fewer tears.
> > 
> > *3)* Not knowing that data has changed on the server until you submit a 
> form.
> > 
> > Ideally there would be a means for someone viewing/editing a form to 
> immediately be notified if data changes on the server, obsoleting the 
> current form. This reduces the amount of wasted time is spent completing a 
> form which is already known to be out of sync, and will need to be redone 
> anyway (as long as problem 1 is solved; otherwise, there'll be data loss)
> > 
> > *4)* Smarter form validation
> > 
> > There are three types of missing validation: 
> > - the first is that the default widgets do not support even very simple 
> client-side validation. For example, a text field might need to match a 
> regular expression. 
> > - the second type is an ability to provide (in the model definition) 
> arbitrary javascript which can be executed client-side to provide richer 
> realtime validation during data entry.
> > - the third type involves effectively providing provisional form data to 
> the server, and having Django validate() the form content without actually 
> saving the result. This would allow (for example) inter-field dependencies 
> to be evaluated without any custom code, providing near-realtime feedback 
> to the user that their form is invalid

Eliminating inter-request race conditions

2021-12-27 Thread Nick Farrell
Hi all.

I've been using Django for quite a number of years now, in various ways. 
Most of the time, I find myself needing to create custom solutions to solve 
what appears to be a very common problem. 

During the Christmas downtime, I decided to scratch this itch, and am 
putting together what will hopefully turn into a solution to what I'll 
describe below. I'm writing this here to get a sense of what the Django 
community sees in this: is this a niche problem, is it shared by a few 
others, or is the lack of these features a fundamental overnight in the 
core Django product?

*The problems *(from highest to lowest priority)*:*

*1)* a form is rendered, the data is changed by a different task/request, 
then the form is submitted, overwriting the recent changes.

Whenever models can be modified by multiple users (or even the same user in 
different windows/tabs of their browser), this can happen. Also, if there 
are any background processes which can modify the data (e.g. celery, or 
various data synchronisation services), it's possible.
In some situations this is no big deal, as the users do not really care, or 
you know that the latest data would overwrite the previous data anyway. But 
in general, this is a major risk, particularly when dealing with any health 
or financial data. 

*2)* Not being able to safely lock a model/queryset beyond the lifetime of 
the request.

This is related to problem 1, and solving problem 2 may in some 
circumstances solve problem 1 - but not always. For example, depending on 
how the lock is implemented, a "rogue" task/request may bypass the locking 
mechanism and force a change to the underlying data. Also, if a lock is 
based on a session, a user may have multiple tabs open in the same browser, 
using the same session state (via shared cookies)

Solving this problem will reduce the chance that when a person does post a 
form update, that there is any conflict, meaning fewer tears.

*3)* Not knowing that data has changed on the server until you submit a 
form.

Ideally there would be a means for someone viewing/editing a form to 
immediately be notified if data changes on the server, obsoleting the 
current form. This reduces the amount of wasted time is spent completing a 
form which is already known to be out of sync, and will need to be redone 
anyway (as long as problem 1 is solved; otherwise, there'll be data loss)

*4)* Smarter form validation

There are three types of missing validation: 
- the first is that the default widgets do not support even very simple 
client-side validation. For example, a text field might need to match a 
regular expression. 
- the second type is an ability to provide (in the model definition) 
arbitrary javascript which can be executed client-side to provide richer 
realtime validation during data entry.
- the third type involves effectively providing provisional form data to 
the server, and having Django validate() the form content without actually 
saving the result. This would allow (for example) inter-field dependencies 
to be evaluated without any custom code, providing near-realtime feedback 
to the user that their form is invalid


*The solutions*
This is based on a day or so's experimentation, and I very much welcome any 
feedback, both in terms of the usefulness of solving these problems in 
general, as well as suggestion on better ways to solve the problems,  
before I go too far down any rabbit holes.

*Enhanced forms*
- when rendering a form (using e.g. as_p()), alongside the normal INPUT DOM 
elements, include additional hidden fields which store a copy of each form 
field's initial value. 
- when a form is submitted, compare these hidden values against the current 
value in the database. If any of these do not match, the clean() method can 
raise a ValidationError, allowing the user to know what has happened, and 
that they will need to reload the form and try again, with the new stored 
values.

This solution is minimally invasive. As well as modifying as_p() and 
friends, a django template tag can also be exposed for those users who are 
rendering their forms in a different way.
Note that there is no reliance on additional attributed in the models: the 
CAS-like checking performed is explicitly on the rendered form fields; it 
does not matter if other model fields' values have changed, as someone 
editing the form can neither see these field values, nor will their POSTing 
modify these other fields' values.
(I have implemented the above already, for generic model forms using a 
single model)

*Locking*
- provide a mixin which can be used on selected models. When used, a view 
(usually some sort of form view) can attempt to lock() the model. If 
successful (because it's not currently locked to someone else), only they 
can perform writes to the model, until the lock expires. 
- if the lock has expired, anyone (including the user who took out an 
expired lock) may overate on the model instance.
- the lock can be 

Re: Integrate a microphone in the Django app

2021-05-24 Thread Nick Sarbicki
Hi,

This isn't really a Django problem to solve, it's more general than that.
First you need the client to record and send an audio file of their mic
recording. This is likely something you want to do in JavaScript, as it is
something that they will have to do on their machine - the server does not
have access to their microphone. I believe you want this:
https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia

After that, converting audio to text is a hard problem. However luckily it
has been solved by several third parties (e.g. Google). So you can rely on
a third party package to do the conversion for you e.g.
https://github.com/Uberi/speech_recognition#readme

- Nick


‪On Mon, May 24, 2021 at 12:40 PM ‫מוריה יצחקי‬‎ 
wrote:‬

> Hello everyone
> I want to allow my app to receive input from a microphone
> I would be happy for help on how to do this in the visual section as well:
> how to put a microphone that allows you to type from the user in HTML and
> how to convert the audio to the text in Python
> Will really really help me
> thank you very much
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2be50a50-946c-4cbd-8041-70848cc52bcen%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2be50a50-946c-4cbd-8041-70848cc52bcen%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt93Kf%3DrK2xLoZ3QhK1HPLn%3Ds0k5wHcnCL82piQr%3DFn8m_g%40mail.gmail.com.


How to Get Video to Play

2020-12-03 Thread Nick Sokol
Hi All,

I am trying to play uploaded video on a django web app but I keep getting a 
white screen and audio. 

Does anyone know how to fix this? Also, is this a django issue or html issue? 

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3EF43401-A003-4250-AFD0-4A6867D93196%40gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3EF43401-A003-4250-AFD0-4A6867D93196%40gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3EF43401-A003-4250-AFD0-4A6867D93196%40gmail.com.


Re: no-referer CSRF error occured in only Edge

2020-07-09 Thread Hella Nick
Wow

Seong Gyu Choi  于2020年7月9日周四 下午9:48写道:

> Django Web Page worked properly well with POST method action in Chrome,
> Firefox. But No-refere CSRF error occurs only in Edge MS browser.
>
> I found someone with an error similar to the one below, and I used the
> method I told you here but couldn't solve it.
>
>
> https://stackoverflow.com/questions/53186554/django-csrf-token-issue-with-edge-only
>
>
> [ Error Page ]
>
> Error 403
>
>
>
>
> You are seeing this message because this HTTPS site requires a “Referer
> header” to be sent by your Web browser, but none was sent. This header is
> required for security reasons, to ensure that your browser is not being
> hijacked by third parties.
>
> If you have configured your browser to disable “Referer” headers, please
> re-enable them, at least for this site, or for HTTPS connections, or for “
> same-origin” requests.
>
> If you are using the  tag or
> including the “Referrer-Policy: no-referrer” header, please remove them.
> The CSRF protection requires the “Referer” header to do strict referer
> checking. If you’re concerned about privacy, use alternatives like  "noreferrer" …> for links to third-party sites.
>
>
> [View.py]
>
> class TslIdDownFormView(TemplateView):
> template_name = 'blog/iddown.html'
> checklist = []
>
> def post(self, request, *args, **kwargs):
>
> checklist = request.POST.getlist('selection')
>
> return render(request, self.template_name, {'checklist':
> checklist})​
>
>
> [url.py]
>
> url_pattern = [
> path('iddown', TslIdDownFormView.as_view(), name='iddown'),
> ]
>
> [template.html]
>
>  target="print_popup" onsubmit="window.open('about:blank', 'print_popup',
> 'width=325,height=520');" >
> {% csrf_token %}
> ​
> 
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/300a9928-8ce2-41a3-8e12-0081aab62162o%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHfGPEe2gW%2B%2BOWb3ew1zz5Gu8AHGM8WanF1CJAD2UD5YzVb%3D2A%40mail.gmail.com.


Re: User.objects.all() only returns username

2020-07-03 Thread Hella Nick
send me your models.py and views.py


RANGA BHARATH JINKA 于2020年7月3日 周五15:13写道:

> Send me views.py
>
> On Fri, 3 Jul 2020, 12:36 pm Mohsen Pahlevanzadeh, <
> m.pahlevanza...@gmail.com> wrote:
>
>> I don't have model.py for auth_user.
>>
>> On Friday, July 3, 2020 at 11:10:17 AM UTC+4:30, RANGA BHARATH JINKA
>> wrote:
>>>
>>> send me your models.py
>>>
>>> On Fri, Jul 3, 2020 at 12:06 PM Mohsen Pahlevanzadeh <
>>> m.pahle...@gmail.com> wrote:
>>>
 When  I use select * from auth_user; I get the following result:
 

 ++++--+--++---+--+--+---++
 | id |
 password
 | last_login | is_superuser | username | first_name | last_name |
 email| is_staff | is_active |
 date_joined|

 ++++--+--++---+--+--+---++
 |  1 |
 pbkdf2_sha256$18$8waw72qXD5IL$nDgySLTPAt3uLNnUMhzpPVodbkGYtYJJsmBilA7X6g8=
 | NULL   |1 | mohsen   ||   |
 moh...@pahlevanzadeh.net |1 | 1 | 2020-07-03
 05:57:34.351606 |
 |  2 |
 pbkdf2_sha256$18$NNVfAk9Z98Uz$5m6HPp42ytlZeyLiy8jsYgUKjREu8WbDeLhAb7dFi0M=
 | NULL   |1 | ali  ||   |
 a...@example.com|1 | 1 | 2020-07-03
 05:58:09.429542 |

 ++++--+--++---+--+--+---++
 2 rows in set (0.000 sec)


 #

 And When I print(User.objects.all()) , I get the following result:
 #
 , ]>
 [03/Jul/2020 05:58:33] "GET /sql/ HTTP/1.1" 200 4
 ##

 Why I can't see all of my fields?

 --
 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...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/12b372dc-973d-482f--0f79997bdadeo%40googlegroups.com
 
 .

>>>
>>>
>>> --
>>> Thanks and Regards
>>>
>>> J. Ranga Bharath
>>> cell: 9110334114
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/a6dc1475-d6ac-48fa-872d-3f8698293414o%40googlegroups.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAK5m316kK5StndUas_i%2BDxzb4EW-QLfufNFA-FidUWxt5skz-w%40mail.gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHfGPEd6sUbfq2cfWb3wiGTxt5VbvBXC_mPTt38fdWs7jz69KA%40mail.gmail.com.


Re: Can someone help me??

2020-07-02 Thread Hella Nick
Thank you Oba Stephen and Mohammed Alnajdi.
I think this is a real BUG.
I'm ready to rebuild the project.
Thank you again.

oba stephen  于2020年7月2日周四 下午2:48写道:

> I don't see anything wrong with the Models.py file, I think you should try
> removing those slash "/" just as Mohammed said.
>
> On Thu, Jul 2, 2020 at 7:40 AM Mohammed Alnajdi 
> wrote:
>
>> The error seems to be somewhere in the Urls
>>
>> I think it might be issue with
>> "{% url 'blog:index/' %}"
>>
>> try to remove the slash
>> "{% url 'blog:index' %}"
>>
>> you might need to do the same with other urls
>>
>>
>> On Thu, Jul 2, 2020 at 9:31 AM Hella Nick  wrote:
>>
>>> class Article(models.Model):
>>>> # time = datetime.datetime.now()
>>>> IMG_LINK = '/static/images/summary.jpg'
>>>> id = models.AutoField(primary_key=True,verbose_name='自增主键')
>>>> title = models.CharField(verbose_name='文章标题',max_length=100)
>>>> intro = models.CharField(max_length=300,verbose_name='文章摘要')
>>>> content = MDTextField(verbose_name='文章正文')
>>>> img_link = models.CharField('图片地址', default=IMG_LINK, max_length=255)
>>>> addtime = models.DateTimeField(verbose_name='发布时间',auto_now =True)
>>>> updatetime = models.DateTimeField(verbose_name='修改时间', auto_now=True)
>>>> number = models.IntegerField(verbose_name='阅读量',default=0)
>>>> loves = models.IntegerField(verbose_name='点赞',default=0)
>>>> keywords = models.CharField(max_length=120,verbose_name='文章关键词',)
>>>> sort = 
>>>> models.ForeignKey('Sort',to_field='id',on_delete=models.CASCADE,verbose_name='分类外键')
>>>> member = 
>>>> models.OneToOneField(User,on_delete=models.CASCADE,related_name='profile',verbose_name='用户一对多外键')
>>>>
>>>> class Mate:
>>>> verbose_name = '文章'
>>>> verbose_name_plural = verbose_name
>>>> ordering = ['-updatetime']
>>>>
>>>> def __str__(self):
>>>> return self.title[:20]
>>>>
>>>> # def get_absolute_url(self):
>>>> # return reversed('blog:article',kwargs={'sulg':self.id})
>>>> # return reverse('blog:detail', kwargs={'pk':self.id})
>>>>
>>>> def body_to_markdown(self):
>>>> return markdown.markdown(self.content.replace("\r\n", '  
>>>> \n'),extensions=[
>>>> 'markdown.extensions.extra',
>>>> 'markdown.extensions.codehilite',
>>>> 'markdown.extensions.toc',
>>>> ],safe_mode=True,enable_attributes = False)
>>>>
>>>> def update_view(self):
>>>> self.number += 1
>>>> self.save(update_fields=['number'])
>>>>
>>>> def get_pre(self):
>>>> return 
>>>> Article.objects.filter(id__lt=self.id).order_by('-id').first()
>>>>
>>>> def get_next(self):
>>>> return 
>>>> Article.objects.filter(id__gt=self.id).order_by('id').first()
>>>>
>>>>
>>> oba stephen  于2020年7月2日周四 下午2:28写道:
>>>
>>>> Can you share your models.py?
>>>>
>>>> Like Sencer said you have to check data types where the "+" operator is
>>>> used.
>>>>
>>>> On Thu, Jul 2, 2020 at 3:55 AM Hella Nick  wrote:
>>>>
>>>>> Dear  Mir  oba stephen:
>>>>>
>>>>>  I deleted  "volume" function,But The result is the same.
>>>>>
>>>>> Hella Nick  于2020年7月2日周四 上午10:51写道:
>>>>>
>>>>>> Dear  Sencer:
>>>>>>
>>>>>>
>>>>>>>   index
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>-
>>>>>>
>>>>>>  There is no problem with writing this wayI don't understand
>>>>>>why.
>>>>>>
>>>>>>
>>>>>> Thank You
>>>>>>
>>>>>> Sencer Hamarat  于2020年7月1日周三 下午5:13写道:
>>>>>>
>>>>>>> File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25,
>>>>>>> in get
>>>>>>> return render(request,'index.html',locals())
>>>

Re: Can someone help me??

2020-07-02 Thread Hella Nick
>
> class Article(models.Model):
> # time = datetime.datetime.now()
> IMG_LINK = '/static/images/summary.jpg'
> id = models.AutoField(primary_key=True,verbose_name='自增主键')
> title = models.CharField(verbose_name='文章标题',max_length=100)
> intro = models.CharField(max_length=300,verbose_name='文章摘要')
> content = MDTextField(verbose_name='文章正文')
> img_link = models.CharField('图片地址', default=IMG_LINK, max_length=255)
> addtime = models.DateTimeField(verbose_name='发布时间',auto_now =True)
> updatetime = models.DateTimeField(verbose_name='修改时间', auto_now=True)
> number = models.IntegerField(verbose_name='阅读量',default=0)
> loves = models.IntegerField(verbose_name='点赞',default=0)
> keywords = models.CharField(max_length=120,verbose_name='文章关键词',)
> sort = 
> models.ForeignKey('Sort',to_field='id',on_delete=models.CASCADE,verbose_name='分类外键')
> member = 
> models.OneToOneField(User,on_delete=models.CASCADE,related_name='profile',verbose_name='用户一对多外键')
>
> class Mate:
> verbose_name = '文章'
> verbose_name_plural = verbose_name
> ordering = ['-updatetime']
>
> def __str__(self):
> return self.title[:20]
>
> # def get_absolute_url(self):
> # return reversed('blog:article',kwargs={'sulg':self.id})
> # return reverse('blog:detail', kwargs={'pk':self.id})
>
> def body_to_markdown(self):
> return markdown.markdown(self.content.replace("\r\n", '  
> \n'),extensions=[
> 'markdown.extensions.extra',
> 'markdown.extensions.codehilite',
> 'markdown.extensions.toc',
> ],safe_mode=True,enable_attributes = False)
>
> def update_view(self):
> self.number += 1
> self.save(update_fields=['number'])
>
> def get_pre(self):
> return Article.objects.filter(id__lt=self.id).order_by('-id').first()
>
> def get_next(self):
> return Article.objects.filter(id__gt=self.id).order_by('id').first()
>
>
oba stephen  于2020年7月2日周四 下午2:28写道:

> Can you share your models.py?
>
> Like Sencer said you have to check data types where the "+" operator is
> used.
>
> On Thu, Jul 2, 2020 at 3:55 AM Hella Nick  wrote:
>
>> Dear  Mir  oba stephen:
>>
>>  I deleted  "volume" function,But The result is the same.
>>
>> Hella Nick  于2020年7月2日周四 上午10:51写道:
>>
>>> Dear  Sencer:
>>>
>>>
>>>>   index
>>>
>>>
>>>
>>>
>>>-
>>>
>>>  There is no problem with writing this wayI don't understand
>>>why.
>>>
>>>
>>> Thank You
>>>
>>> Sencer Hamarat  于2020年7月1日周三 下午5:13写道:
>>>
>>>> File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in
>>>> get
>>>> return render(request,'index.html',locals())
>>>>
>>>> According to this line in that error seems to have occurred while
>>>> rendering.
>>>> There is at least one "+" operation in "index.html" or "local()" method
>>>> call.
>>>> You have to check data types where the "+" operator used.
>>>> And also according to the error itself, the one of that value is not a
>>>> string.
>>>> I think the "ModelBase" model has no '__str__'.
>>>>
>>>> Saygılarımla,
>>>> Sencer HAMARAT
>>>>
>>>>
>>>>
>>>> On Wed, Jul 1, 2020 at 12:04 PM oba stephen 
>>>> wrote:
>>>>
>>>>> The Error is straight forward, you are using an operand "+" for two
>>>>> two data types that it can't be used on. This might be from your "volume"
>>>>> function.
>>>>>
>>>>> On Wed, Jul 1, 2020 at 9:30 AM Hella Nick 
>>>>> wrote:
>>>>>
>>>>>> Can someone help me??
>>>>>>
>>>>>>
>>>>>> My project catalogue:
>>>>>>
>>>>>>
>>>>>> My setttings:
>>>>>>
>>>>>> TEMPLATES = [
>>>>>> {
>>>>>> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>>>>>> 'DIRS': [os.path.join(BASE_DIR, 'blog/templates/')]
>>>>>> ,
>>>>>> 'APP_DIRS': True,
>>>>>> 'OPTIONS': {
>>>>>>

Re: Can someone help me??

2020-07-01 Thread Hella Nick
Dear  Mir  oba stephen:

 I deleted  "volume" function,But The result is the same.

Hella Nick  于2020年7月2日周四 上午10:51写道:

> Dear  Sencer:
>
>
>>   index
>
>
>
>
>-
>
>  There is no problem with writing this wayI don't understand why.
>
>
> Thank You
>
> Sencer Hamarat  于2020年7月1日周三 下午5:13写道:
>
>> File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in get
>> return render(request,'index.html',locals())
>>
>> According to this line in that error seems to have occurred while
>> rendering.
>> There is at least one "+" operation in "index.html" or "local()" method
>> call.
>> You have to check data types where the "+" operator used.
>> And also according to the error itself, the one of that value is not a
>> string.
>> I think the "ModelBase" model has no '__str__'.
>>
>> Saygılarımla,
>> Sencer HAMARAT
>>
>>
>>
>> On Wed, Jul 1, 2020 at 12:04 PM oba stephen 
>> wrote:
>>
>>> The Error is straight forward, you are using an operand "+" for two two
>>> data types that it can't be used on. This might be from your "volume"
>>> function.
>>>
>>> On Wed, Jul 1, 2020 at 9:30 AM Hella Nick  wrote:
>>>
>>>> Can someone help me??
>>>>
>>>>
>>>> My project catalogue:
>>>>
>>>>
>>>> My setttings:
>>>>
>>>> TEMPLATES = [
>>>> {
>>>> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>>>> 'DIRS': [os.path.join(BASE_DIR, 'blog/templates/')]
>>>> ,
>>>> 'APP_DIRS': True,
>>>> 'OPTIONS': {
>>>> 'context_processors': [
>>>> 'django.template.context_processors.debug',
>>>> 'django.template.context_processors.request',
>>>> 'django.contrib.auth.context_processors.auth',
>>>> 'django.contrib.messages.context_processors.messages',
>>>> ],
>>>> },
>>>> },
>>>> ]
>>>>
>>>>
>>>> My views:
>>>>
>>>> from django.shortcuts import render,HttpResponse
>>>> from django.views.generic import View
>>>> from blog.tool.IPs import volume
>>>> from blog.models import Article
>>>>
>>>> class index(View):
>>>> def get(self,request):
>>>> volume(request)
>>>>
>>>> return render(request,'index.html')
>>>>
>>>>
>>>> Error:
>>>>
>>>>
>>>> Internal Server Error: /blog/index/
>>>> Traceback (most recent call last):
>>>>   File
>>>> "D:\Python3\lib\site-packages\django\core\handlers\exception.py", line 34,
>>>> in inner
>>>> response = get_response(request)
>>>>   File "D:\Python3\lib\site-packages\django\core\handlers\base.py",
>>>> line 126, in _get_response
>>>> response = self.process_exception_by_middleware(e, request)
>>>>   File "D:\Python3\lib\site-packages\django\core\handlers\base.py",
>>>> line 124, in _get_response
>>>> response = wrapped_callback(request, *callback_args,
>>>> **callback_kwargs)
>>>>   File "D:\Python3\lib\site-packages\django\views\generic\base.py",
>>>> line 68, in view
>>>> return self.dispatch(request, *args, **kwargs)
>>>>   File "D:\Python3\lib\site-packages\django\views\generic\base.py",
>>>> line 88, in dispatch
>>>> return handler(request, *args, **kwargs)
>>>>   File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in
>>>> get
>>>> return render(request,'index.html',locals())
>>>>   File "D:\Python3\lib\site-packages\django\shortcuts.py", line 36, in
>>>> render
>>>> content = loader.render_to_string(template_name, context, request,
>>>> using=using)
>>>>   File "D:\Python3\lib\site-packages\django\template\loader.py", line
>>>> 62, in render_to_string
>>>> return template.render(context, request)
>>>>   File
>>>> "D:\Python3\lib\site-packages\django\template\backends\django.py", line 61

Re: Can someone help me??

2020-07-01 Thread Hella Nick
Dear  Sencer:


>   index




   -

 There is no problem with writing this wayI don't understand why.


Thank You

Sencer Hamarat  于2020年7月1日周三 下午5:13写道:

> File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in get
> return render(request,'index.html',locals())
>
> According to this line in that error seems to have occurred while
> rendering.
> There is at least one "+" operation in "index.html" or "local()" method
> call.
> You have to check data types where the "+" operator used.
> And also according to the error itself, the one of that value is not a
> string.
> I think the "ModelBase" model has no '__str__'.
>
> Saygılarımla,
> Sencer HAMARAT
>
>
>
> On Wed, Jul 1, 2020 at 12:04 PM oba stephen  wrote:
>
>> The Error is straight forward, you are using an operand "+" for two two
>> data types that it can't be used on. This might be from your "volume"
>> function.
>>
>> On Wed, Jul 1, 2020 at 9:30 AM Hella Nick  wrote:
>>
>>> Can someone help me??
>>>
>>>
>>> My project catalogue:
>>>
>>>
>>> My setttings:
>>>
>>> TEMPLATES = [
>>> {
>>> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>>> 'DIRS': [os.path.join(BASE_DIR, 'blog/templates/')]
>>> ,
>>> 'APP_DIRS': True,
>>> 'OPTIONS': {
>>> 'context_processors': [
>>> 'django.template.context_processors.debug',
>>> 'django.template.context_processors.request',
>>> 'django.contrib.auth.context_processors.auth',
>>> 'django.contrib.messages.context_processors.messages',
>>> ],
>>> },
>>> },
>>> ]
>>>
>>>
>>> My views:
>>>
>>> from django.shortcuts import render,HttpResponse
>>> from django.views.generic import View
>>> from blog.tool.IPs import volume
>>> from blog.models import Article
>>>
>>> class index(View):
>>> def get(self,request):
>>> volume(request)
>>>
>>> return render(request,'index.html')
>>>
>>>
>>> Error:
>>>
>>>
>>> Internal Server Error: /blog/index/
>>> Traceback (most recent call last):
>>>   File "D:\Python3\lib\site-packages\django\core\handlers\exception.py",
>>> line 34, in inner
>>> response = get_response(request)
>>>   File "D:\Python3\lib\site-packages\django\core\handlers\base.py", line
>>> 126, in _get_response
>>> response = self.process_exception_by_middleware(e, request)
>>>   File "D:\Python3\lib\site-packages\django\core\handlers\base.py", line
>>> 124, in _get_response
>>> response = wrapped_callback(request, *callback_args,
>>> **callback_kwargs)
>>>   File "D:\Python3\lib\site-packages\django\views\generic\base.py", line
>>> 68, in view
>>> return self.dispatch(request, *args, **kwargs)
>>>   File "D:\Python3\lib\site-packages\django\views\generic\base.py", line
>>> 88, in dispatch
>>> return handler(request, *args, **kwargs)
>>>   File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in
>>> get
>>> return render(request,'index.html',locals())
>>>   File "D:\Python3\lib\site-packages\django\shortcuts.py", line 36, in
>>> render
>>> content = loader.render_to_string(template_name, context, request,
>>> using=using)
>>>   File "D:\Python3\lib\site-packages\django\template\loader.py", line
>>> 62, in render_to_string
>>> return template.render(context, request)
>>>   File
>>> "D:\Python3\lib\site-packages\django\template\backends\django.py", line 61,
>>> in render
>>> return self.template.render(context)
>>>   File "D:\Python3\lib\site-packages\django\template\base.py", line 171,
>>> in render
>>> return self._render(context)
>>>   File "D:\Python3\lib\site-packages\django\template\base.py", line 163,
>>> in _render
>>> return self.nodelist.render(context)
>>>   File "D:\Python3\lib\site-packages\django\template\base.py", line 937,
>>> in render
>>> bit = node.render_annotated(context)
>>>   File "D:\Python

Can someone help me??

2020-07-01 Thread Hella Nick
Can someone help me??


My project catalogue: 


My setttings:

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'blog/templates/')]
,
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]


My views:

from django.shortcuts import render,HttpResponse
from django.views.generic import View
from blog.tool.IPs import volume
from blog.models import Article

class index(View):
def get(self,request):
volume(request)
 
return render(request,'index.html')


Error:


Internal Server Error: /blog/index/
Traceback (most recent call last):
  File "D:\Python3\lib\site-packages\django\core\handlers\exception.py", 
line 34, in inner
response = get_response(request)
  File "D:\Python3\lib\site-packages\django\core\handlers\base.py", line 
126, in _get_response
response = self.process_exception_by_middleware(e, request)
  File "D:\Python3\lib\site-packages\django\core\handlers\base.py", line 
124, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "D:\Python3\lib\site-packages\django\views\generic\base.py", line 
68, in view
return self.dispatch(request, *args, **kwargs)
  File "D:\Python3\lib\site-packages\django\views\generic\base.py", line 
88, in dispatch
return handler(request, *args, **kwargs)
  File "D:\pythonwork\blog\personBlog\blog\views\index.py", line 25, in get
return render(request,'index.html',locals())
  File "D:\Python3\lib\site-packages\django\shortcuts.py", line 36, in 
render
content = loader.render_to_string(template_name, context, request, 
using=using)
  File "D:\Python3\lib\site-packages\django\template\loader.py", line 62, 
in render_to_string
return template.render(context, request)
  File "D:\Python3\lib\site-packages\django\template\backends\django.py", 
line 61, in render
return self.template.render(context)
  File "D:\Python3\lib\site-packages\django\template\base.py", line 171, in 
render
return self._render(context)
  File "D:\Python3\lib\site-packages\django\template\base.py", line 163, in 
_render
return self.nodelist.render(context)
  File "D:\Python3\lib\site-packages\django\template\base.py", line 937, in 
render
bit = node.render_annotated(context)
  File "D:\Python3\lib\site-packages\django\template\base.py", line 904, in 
render_annotated
return self.render(context)
  File "D:\Python3\lib\site-packages\django\template\defaulttags.py", line 
442, in render
url = reverse(view_name, args=args, kwargs=kwargs, 
current_app=current_app)
  File "D:\Python3\lib\site-packages\django\urls\base.py", line 58, in 
reverse
app_list = resolver.app_dict[ns]
  File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line 477, 
in app_dict
self._populate()
  File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line 430, 
in _populate
url_pattern._populate()
  File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line 418, 
in _populate
self._callback_strs.add(url_pattern.lookup_str)
  File "D:\Python3\lib\site-packages\django\utils\functional.py", line 37, 
in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File "D:\Python3\lib\site-packages\django\urls\resolvers.py", line 360, 
in lookup_str
return callback.__module__ + "." + callback.__qualname__
TypeError: unsupported operand type(s) for +: 'ModelBase' and 'str'


   - 
   
   Can someone help me??
   


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/840576c0-ef86-46ea-b35c-8a3708f7460bo%40googlegroups.com.


Re: Please help me out!!!!!

2020-06-03 Thread Hella Nick
请检查您的路由地址,问题就出现在那里。

meera gangani 于2020年6月3日 周三15:19写道:

> Hello Django-users
>
> href is not working
> here is my views.py file and my urls.py file
>
> Please Help me out!!
>
> Thank you in advance
> -Meera
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANaPPPLbk6JV8tQjxkKUiN-H%3D_JLHjztMQfGLK6oUx9ootEojg%40mail.gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHfGPEc9AZU0Y-xJLBZ0N2jwoDVioG3SLnnTQOickCE%3DsQOKsQ%40mail.gmail.com.


Re: pagination of a specific context in multiple context in ListView not working in django?

2020-06-02 Thread Hella Nick
Do you use Django or Django Rest Framework?

Ali Ahammad  于2020年6月2日周二 上午7:51写道:

> in django, i am trying to list some queries of several objects like user
> lists, categoies and Post list. the homepage will be contained couple of
> blocks or boxes. each box will have different query list like Post list,
> User List, category list. But only one context will have pagination and
> other won't and ofcourse the pagination will be working on Post list.
>
> here is the views.py:
>
> class BlogappListView(ListView):
> model = Category,CustomUser
> template_name = 'home.html'
> context_object_name='category_list'
> queryset=Category.objects.all()
> paginate_by = 2
>
> def get_context_data(self, **kwargs):
> context = super(BlogappListView, self).get_context_data(**kwargs)
> context['user_list']= CustomUser.objects.all()
> context['post_list']=Post.objects.all()
> activities=context['post_list']
> return context
> def get_related_activities(self,activities):
> queryset=self.objects.activity_rel.all()
> paginator=Paginator(queryset,2)
> page=self.request.GET.get('page')
> activities=paginator.get_page(page)
> return(activities)
> in urls.py:
>
> urlpatterns = [
> path('',BlogappListView.as_view(),name='home'),
> ]
> in base.html, the paginate portion code:
>
> 
>   {% if is_paginated %}
>
> {% if page_obj.has_previous %}
> 
> First
>   
>   
>   Previous
> 
> {% endif %}
>
> {% for num in page_obj.paginator.page_range %}
>   {% if page_obj.number == num %}
>   
> {{ num
> }}
>   
>
>   {% elif num > page_obj.number|add:'-3' and num <
> page_obj.number|add:'3' %}
>   
> {{ num
> }}
>   
>
>   {% endif %}
> {% endfor %}
>
> {% if page_obj.has_next %}
> 
>   Next
> 
>   
>   Last
> 
>
> {% endif %}
>
>   {% endif %}
> 
> the main problem is that page number 1 is showing all the posts and also
> the second page. and category list is also truncated into 2 but the user
> list ok.
>
> so how can i make it work ? is there any other way?
>
> thank you 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/695c35d0-4841-4aaf-9080-7817cbe27fa9%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHfGPEeNBN4pibXa064xGR6J2J7cKZshHiHUBdv88XcOUBfHGw%40mail.gmail.com.


Re: Model Arithmetic Operation

2020-06-02 Thread Hella Nick
   -

   Niggers are clearly not suited for the job.


Ifeanyi Chielo  于2020年6月3日周三 上午7:43写道:

> Dear all,
>
> Hello, please can someone help me with the code to subtract  'b' from 'a'
> as shown below
>
>
> a = Soapprod.objects.aggregate(Sum('Serial_White_Guava'))
>
>
>
> b = Soapsales.objects.aggregate(Sum('Serial_White_Guava'))
>
>
>
> class Soapprod (models.Model):
>
> id = models.AutoField(primary_key=True)
>
> Serial_White_Guava  = models.PositiveIntegerField()
>
> Serial_White_Premium= models.PositiveIntegerField()
>
> Soft_Flower_Body_Wash   = models.PositiveIntegerField()
>
> Soft_Flower_Fresh   = models.PositiveIntegerField()
>
> Soft_Flower_Orange_Lightening   = models.PositiveIntegerField()
>
> Soft_Flower_Carot_Lightening= models.PositiveIntegerField()
>
> Soft_Flower_Papaya_Extract  = models.PositiveIntegerField()
>
> Soft_Flower_Extra_Lightening= models.PositiveIntegerField()
>
> Serial_White_Papaya_4in1= models.PositiveIntegerField()
>
> date= models.DateField(default
>  = date.today)
>
>
>
> def __str__(self):
>
> return self.serial_white_guava
>
>
>
> class Soapsales (Soapprod):
>
> SOAP_MARKETER_STATUS = (
>
> ('M', 'Marketers'),
>
> ('D', 'Distributor'),
>
> ('A', 'Distributor_B'),
>
> ('B', 'Distributor_C'),
>
> )
>
> soap_marketer_status = models.CharField(max_length=1, choices
> =SOAP_MARKETER_STATUS)
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1c978c25-cbb4-41bd-ab01-b49aa6365826%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHfGPEfi9UkV0dd89KVnNRoNMJMJMNGhd63JWMQAVaDjYURw3g%40mail.gmail.com.


Re: django-tenants domain issue

2020-06-02 Thread Hella Nick
你是要部署在互联网上吗?

DumbaClassics  于2020年6月3日周三 上午8:56写道:

> Hello Family
>
> I have been following a set up documentation for django-tenants. I did all
> the set-up to even create a public domain and two tenant domains. For
> allowed hosts I put ["*"] , though not safe as per clinical research data
> its convinient for my localhost Test. I am having a challenge navigating to
> all my domains. The usual http://127.0.0.1: 8000/ gives me No tenant for
> hostname "127.0.0.1" which is of course reasonable...say my domain name for
> public is d.dumba.local and the tenant one td.test.local what would be the
> way to navigating to these domains.
>
> Your cooperation will be appreciated
>
> Sincerly D.C
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/aafcef35-db62-4e0d-a744-0e94609dc9ab%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHfGPEdbnOcWJre8MpTj7BTt8SNY%3DhEnh_Ze54BRyiZfZa84%3Dg%40mail.gmail.com.


Re: Integrate wepay payments in django site

2020-05-26 Thread Hella Nick
你应该是阿三吧?

Akshat Zala  于2020年5月20日周三 上午11:32写道:

> You can install the following package and study the documentation:
>
> 1. https://pypi.org/project/django-wepay/
>
> On Tuesday, 19 May 2020 22:56:24 UTC+5:30, Shyam Acharjya wrote:
>>
>> greetings,
>>
>> has anyone here have any prior experience in integrating wepay to a
>> django site? if yes please share the process it would be a really big help
>>
>> regards.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/09be28b5-8ea3-4c49-a538-308d81dce06d%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHfGPEeRQ9b30rUEmDZzCm%2BS8gsz3Jb5PjKVJYs_rBKv77Cn%2BQ%40mail.gmail.com.


Re: Getting the except django.core.exceptions.ImproperlyConfigured while querying DB

2020-05-20 Thread Hella Nick
此处有语法错误: path('display_data/', views.display_data, name=
'display_data'),
正确的写法为:path(r'^display_data//$', views.display_data, name=
'display_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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHfGPEe6TDiKM_p4W_%2BpsJtp3c3-yV5%3DtFouXXwKqoHORWqPng%40mail.gmail.com.


Re: Getting the except django.core.exceptions.ImproperlyConfigured while querying DB

2020-05-20 Thread Hella Nick
如果您确定数据库中有数据的话,那么就是您该视图的url设计错误。Django数据库查询的get方法查询不到数据会报错。希望可以帮助到您。

ratnadeep ray  于2020年5月20日周三 下午4:16写道:

> I am trying to fetch a few rows from the DB using the following code in my
> views.py:
>
> from django.http import HttpResponsefrom django.shortcuts import renderfrom 
> fusioncharts.models import QRC_DB
> def display_data(request,component):
> query_results = QRC_DB.objects.get(component_name__contains=component)
> return HttpResponse("You're looking at the component %s." % component)
>
> For the above, I am getting the following exception:
>
> django.core.exceptions.ImproperlyConfigured: The included URLconf 
> 'Piechart_Excel.urls' does not appear to have any patterns in it. If you see 
> valid patterns in the file then the issue is probably caused by a circular 
> import.
>
> However whenever I am *removing/commenting out* the below line, the above 
> exception disappears:
>
> query_results = QRC_DB.objects.get(component_name__contains=component)
>
>
> Can anyone say what can be going wrong here?
>
> urls.py file under app is as follows:
>
> from django.urls import path from fusioncharts import views urlpatterns 
> urlpatterns
>> = [
>> path('push-data/', views.push_data, name='push-data'),
>> path('home/', views.home, name='home'),
>> path('display_data/', views.display_data, name=
>> 'display_data'),
>> ]
>
> The url under the main project is as follows:
>
> from django.contrib import adminfrom django.urls import path,include
>>
>> urlpatterns urlpatterns = [
>> path('admin/', admin.site.urls),
>> path('', include('fusioncharts.urls'))
>> ]
>
> So please advise what's going wrong.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0acc7888-9e25-43fd-8a50-64fe43086190%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHfGPEd6_f3W7fCiS-aSvkC5X%2BbTNRiUFXFTV_qjECAZyfGrNQ%40mail.gmail.com.


Re: Can't Fix the No Reverse Error in Ajax

2020-05-20 Thread Hella Nick
是的,正确的写法为
  Like 

Motaz Hejaze  于2020年5月20日周三 下午2:06写道:

> Change your ajax method from "post" to "get" , you are not submitting any
> data to use post .
>
> Also change the method in your form too , and share the error message
> please.
>
> On Wed, 20 May 2020, 6:18 am Ahmed Khairy, 
> wrote:
>
>> Do you mean that this line should be changed?
>>
>> > 'post_id' class= "btn btn-danger btn-sm" value="{{post.id}}"
>> > No ! Don't Print it 
>>
>> On Tuesday, May 19, 2020 at 11:11:12 PM UTC-4, Hella Nick wrote:
>>>
>>> button标签中的type属性设置为button,
>>>
>>> Ahmed Khairy  于2020年5月20日周三 上午1:54写道:
>>>
>>>> I am trying to use Ajax to submit a like button, I believe everything
>>>> is in order but I keep getting django.urls.exceptions.NoReverseMatch:
>>>> Reverse for 'like_post' with arguments '('',)' not found. 1 pattern(s)
>>>> tried: ['score/like/(?P[0-9]+)$']
>>>>
>>>>
>>>> I am not sure what is the reason. Need help to identify the error.
>>>>
>>>>
>>>> Here is the view
>>>>
>>>>
>>>> class PostDetailView(DetailView):
>>>> model = Post
>>>> template_name = "post_detail.html"
>>>>
>>>> def get_context_data(self, *args, **kwargs):
>>>> context = super(PostDetailView, self).get_context_data()
>>>> stuff = get_object_or_404(Post, id=self.kwargs['pk'])
>>>> total_likes = stuff.total_likes()
>>>> liked = False
>>>> if stuff.likes.filter(id=self.request.user.id).exists():
>>>> liked = True
>>>> context["total_likes"] = total_likes
>>>> context["liked"] = liked
>>>> return context
>>>>
>>>>
>>>> def LikeView(request, pk):
>>>> # post = get_object_or_404(Post, id=request.POST.get('post_id'))
>>>> post = get_object_or_404(Post, id=request.POST.get('id'))
>>>> like = False
>>>> if post.likes.filter(id=request.user.id).exists():
>>>> post.likes.remove(request.user)
>>>> like = False
>>>> else:
>>>> post.likes.add(request.user)
>>>> like = True
>>>> context["total_likes"] = total_likes
>>>> context["liked"] = liked
>>>>
>>>> if request.is_ajax:
>>>> html = render_to_string('like_section.html', context, request=
>>>> request)
>>>> return JsonResponse({'form': html})
>>>>
>>>> Here is the url.py updated
>>>>
>>>> urlpatterns = [
>>>> path('user/', UserPostListView.as_view(), name=
>>>> 'user-posts'),
>>>> path('', PostListView.as_view(), name='score'),
>>>> path('who_we_Are/', who_we_are, name='who_we_are'),
>>>> path('/', PostDetailView.as_view(), name='post-detail'),
>>>> path('like/', LikeView, name='like_post'),
>>>> path('new/', PostCreateView.as_view(), name='post-create'),
>>>> path('/update/', PostUpdateView.as_view(), name=
>>>> 'post-update'),
>>>> path('/delete/', PostDeleteView.as_view(), name=
>>>> 'post-delete')
>>>> ]
>>>>
>>>> here is the template
>>>>
>>>> 
>>>> {% csrf_token %}
>>>>  Likes: {{total_likes}} 
>>>> {% if user.is_authenticated %}
>>>> {% if liked %}
>>>> >>> 'post_id' class= "btn btn-danger btn-sm"
>>>> value="{{post.id}}"> Unlike 
>>>> {% else %}
>>>> >>> 'post_id' class= "btn btn-primary btn-sm"
>>>> value="{{post.id}}"> Like 
>>>> {% endif  %}
>>>> {% else %}
>>>> >>> > Login to Like 
>>>> {% endif %}
>>>> 
>>>>
>>>> here is the ajax
>>>>
>>>> https://aj

Re: NEW TO DJANGO

2020-05-19 Thread Hella Nick
你是阿三吗?

Akshat Zala  于2020年5月20日周三 上午11:27写道:

> I agree with Vishesh, You require api key which needs to be in settings.py
> file
>
> On Tuesday, 19 May 2020 20:43:17 UTC+5:30, Vishesh Mangla wrote:
>>
>> Your question is not clear to me. What exactly do you want ?You do not
>> require django to go to a site , rather you require a hyperlink.
>>
>>
>>
>>
>>
>> Sent from Mail  for
>> Windows 10
>>
>>
>>
>> *From: *Madhav Nandan
>> *Sent: *19 May 2020 20:34
>> *To: *django...@googlegroups.com
>> *Subject: *NEW TO DJANGO
>>
>>
>>
>> Dear Django fellas,
>>
>>
>>
>> I'm new to Django here. I started learning and it's been a while and I'm
>> facing a lot of issues. Can somebody help me with *''how can I integrate
>> a payment system like PayPal to a link?''*
>>
>>  Like I have a link, if someone clicks on that link that will redirect
>> the user to the payment page and there on the payment provider works.
>>
>>
>>
>> I just need to get started and somebody can guide me here hopefully. I
>> don't' need code or so.
>>
>>
>>
>> Help me here.
>>
>>
>>
>> Best regards,
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>>
>> Madhav Nandan
>>
>> cell: 9170459494
>>
>> Skype: gaurav.kumar3992
>>
>>
>>
>> --
>> 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...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAGXYL6JYzv%3DvTRNXc1ZqSvJ-6S%3DOSJt%2B%3D_%3DhLqvwyaD0Z_NoDA%40mail.gmail.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/433e54a0-11c6-490a-b21a-d2ab4de778c2%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHfGPEezv6e-TRVG6en43jxfdPe9CDGL2hKR_Wtz-XfJDYkPWw%40mail.gmail.com.


Re: Can't Fix the No Reverse Error in Ajax

2020-05-19 Thread Hella Nick
Django中的表单提交按钮不要使用submit属性,否则会触发get请求,或者发生错误。

Hella Nick  于2020年5月20日周三 上午11:09写道:

> button标签中的type属性设置为button,
>
> Ahmed Khairy  于2020年5月20日周三 上午1:54写道:
>
>> I am trying to use Ajax to submit a like button, I believe everything is
>> in order but I keep getting django.urls.exceptions.NoReverseMatch: Reverse
>> for 'like_post' with arguments '('',)' not found. 1 pattern(s) tried:
>> ['score/like/(?P[0-9]+)$']
>>
>>
>> I am not sure what is the reason. Need help to identify the error.
>>
>>
>> Here is the view
>>
>>
>> class PostDetailView(DetailView):
>> model = Post
>> template_name = "post_detail.html"
>>
>> def get_context_data(self, *args, **kwargs):
>> context = super(PostDetailView, self).get_context_data()
>> stuff = get_object_or_404(Post, id=self.kwargs['pk'])
>> total_likes = stuff.total_likes()
>> liked = False
>> if stuff.likes.filter(id=self.request.user.id).exists():
>> liked = True
>> context["total_likes"] = total_likes
>> context["liked"] = liked
>> return context
>>
>>
>> def LikeView(request, pk):
>> # post = get_object_or_404(Post, id=request.POST.get('post_id'))
>> post = get_object_or_404(Post, id=request.POST.get('id'))
>> like = False
>> if post.likes.filter(id=request.user.id).exists():
>> post.likes.remove(request.user)
>> like = False
>> else:
>> post.likes.add(request.user)
>> like = True
>> context["total_likes"] = total_likes
>> context["liked"] = liked
>>
>> if request.is_ajax:
>> html = render_to_string('like_section.html', context, request=
>> request)
>> return JsonResponse({'form': html})
>>
>> Here is the url.py updated
>>
>> urlpatterns = [
>> path('user/', UserPostListView.as_view(), name=
>> 'user-posts'),
>> path('', PostListView.as_view(), name='score'),
>> path('who_we_Are/', who_we_are, name='who_we_are'),
>> path('/', PostDetailView.as_view(), name='post-detail'),
>> path('like/', LikeView, name='like_post'),
>> path('new/', PostCreateView.as_view(), name='post-create'),
>> path('/update/', PostUpdateView.as_view(), name='post-update'
>> ),
>> path('/delete/', PostDeleteView.as_view(), name='post-delete'
>> )
>> ]
>>
>> here is the template
>>
>> 
>> {% csrf_token %}
>>  Likes: {{total_likes}} 
>> {% if user.is_authenticated %}
>> {% if liked %}
>> > 'post_id' class= "btn btn-danger btn-sm"
>> value="{{post.id}}"> Unlike 
>> {% else %}
>> > 'post_id' class= "btn btn-primary btn-sm"
>> value="{{post.id}}"> Like 
>> {% endif  %}
>> {% else %}
>> > > Login to Like 
>> {% endif %}
>> 
>>
>> here is the ajax
>>
>> https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js&quot</a>;></
>> script>
>>
>> <script type="text/javascript">
>> $(document).ready(function(event){
>> $(document).on.('click','#like', function(event){
>> event.preventDefault();
>> $var pk= $(this).attr('value');
>> $.ajax({
>> type:'POST',
>> url:'{% url "score:like_post" post.pk %}',
>> data:{'id': pk, 'csrfmiddlewaretoken':
>> '{{csrf_token}}'},
>> dataType:'json',
>> success:function(response){
>> $('#like-section').html(response['form'])
>> console.log($('#like-section').html(response[
>> 'form']));
>> },
>> error:function(rs, e){
>> console.log(rs.responseText);
>> },
>> });
>> });
>> });
>> 
>>
>>
>> --
>> You received this mes

Re: Can't Fix the No Reverse Error in Ajax

2020-05-19 Thread Hella Nick
button标签中的type属性设置为button,

Ahmed Khairy  于2020年5月20日周三 上午1:54写道:

> I am trying to use Ajax to submit a like button, I believe everything is
> in order but I keep getting django.urls.exceptions.NoReverseMatch: Reverse
> for 'like_post' with arguments '('',)' not found. 1 pattern(s) tried:
> ['score/like/(?P[0-9]+)$']
>
>
> I am not sure what is the reason. Need help to identify the error.
>
>
> Here is the view
>
>
> class PostDetailView(DetailView):
> model = Post
> template_name = "post_detail.html"
>
> def get_context_data(self, *args, **kwargs):
> context = super(PostDetailView, self).get_context_data()
> stuff = get_object_or_404(Post, id=self.kwargs['pk'])
> total_likes = stuff.total_likes()
> liked = False
> if stuff.likes.filter(id=self.request.user.id).exists():
> liked = True
> context["total_likes"] = total_likes
> context["liked"] = liked
> return context
>
>
> def LikeView(request, pk):
> # post = get_object_or_404(Post, id=request.POST.get('post_id'))
> post = get_object_or_404(Post, id=request.POST.get('id'))
> like = False
> if post.likes.filter(id=request.user.id).exists():
> post.likes.remove(request.user)
> like = False
> else:
> post.likes.add(request.user)
> like = True
> context["total_likes"] = total_likes
> context["liked"] = liked
>
> if request.is_ajax:
> html = render_to_string('like_section.html', context, request=
> request)
> return JsonResponse({'form': html})
>
> Here is the url.py updated
>
> urlpatterns = [
> path('user/', UserPostListView.as_view(), name=
> 'user-posts'),
> path('', PostListView.as_view(), name='score'),
> path('who_we_Are/', who_we_are, name='who_we_are'),
> path('/', PostDetailView.as_view(), name='post-detail'),
> path('like/', LikeView, name='like_post'),
> path('new/', PostCreateView.as_view(), name='post-create'),
> path('/update/', PostUpdateView.as_view(), name='post-update'
> ),
> path('/delete/', PostDeleteView.as_view(), name='post-delete')
> ]
>
> here is the template
>
> 
> {% csrf_token %}
>  Likes: {{total_likes}} 
> {% if user.is_authenticated %}
> {% if liked %}
>  'post_id' class= "btn btn-danger btn-sm"
> value="{{post.id}}"> Unlike 
> {% else %}
>  'post_id' class= "btn btn-primary btn-sm"
> value="{{post.id}}"> Like 
> {% endif  %}
> {% else %}
>  Login a> to Like 
> {% endif %}
> 
>
> here is the ajax
>
> https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";> >
>
> 
> $(document).ready(function(event){
> $(document).on.('click','#like', function(event){
> event.preventDefault();
> $var pk= $(this).attr('value');
> $.ajax({
> type:'POST',
> url:'{% url "score:like_post" post.pk %}',
> data:{'id': pk, 'csrfmiddlewaretoken':'{{csrf_token}}'
> },
> dataType:'json',
> success:function(response){
> $('#like-section').html(response['form'])
> console.log($('#like-section').html(response[
> 'form']));
> },
> error:function(rs, e){
> console.log(rs.responseText);
> },
> });
> });
> });
> 
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5aaa1274-dd6b-42bc-8a5e-bce4596ace98%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHfGPEfgvvS1LMvF3FWM8Hb%3DbPoFVDVWM8anE1YwxN64KCviKA%40mail.gmail.com.


Re: PROBLEM WITH Multiple SETTINGS.PY FILE

2020-05-19 Thread Hella Nick
你帮我获得加拿大的工作移民签证,我就可以帮你解决问题。

在 2020年5月17日星期日 UTC+8上午4:51:45,chaitan写道:
>
> Hi, I am facing ModuleNotFoundError in my Django application. It got 
> configured with multiple settings files for production, Development & 
> Testing. 
> When I Try to run Python manage.py runserver --settings= settings_dev_sai. 
>
> This is My *Settings* File:
>
> import socket
>
> #import settings depending on the box we are on
> HOST = socket.gethostname()
> TPA_CODE = "Bridge"
> TPA_NAME = "Bridge Benefits System"
>
> #development
> if HOST == "BITS-DP-LAPTOP":
> from settings_dev import *
> TPA_NAME = "ICBA Benefit Services Ltd."
> TPA_CODE = 'ICBA' 
> #DFG bridge
> elif HOST == "dfginternal":
> from settings_dfg_ees import *
> TPA_NAME = "Dehoney Financial Group"
> TPA_CODE = 'DFG' 
> #test
> elif HOST == "DFGTEST02":
> from settings_staging import *
> elif HOST == "icbaweb":
> from settings_production_icba import *
> TPA_NAME = "ICBA Benefit Services Ltd."
> TPA_CODE = 'ICBA' 
> elif HOST == "meritweb":
> from settings_production_merit import *
> TPA_NAME = "Ontario Construction Industry Benefit Plan"
> TPA_CODE = 'MERIT' 
> elif HOST == "dfgweb" :
> from settings_production_dfg import *
> TPA_NAME = "Dehoney Financial Group"
> TPA_CODE = 'DFG' 
> elif HOST == "dev" or HOST == "j-ubu" :
> from settings_dev_baikal import *
> elif HOST == "jdev" :
> from settings_dev_juliab import *
> elif HOST == "Sai" :
> from settings_dev_sai import *
> elif HOST == "johnstonesweb" :
> from settings_production_johnstones import *
> TPA_NAME = "Johnstone's Benefits"
> TPA_CODE = 'JOHNSTONES' 
> elif HOST == "bridgedemo" :
> from settings_demo import *
> TPA_CODE = "Bridge"
> TPA_NAME = "Bridge Benefits System"
> else:
> raise ImportError("This server's hostname [" + HOST + "] does not have 
> a proper expanded settings file. Please configure one.")
> *
>
> This is my *settings_dev_sai*
>
> from settings_common import *
>
> DEBUG = True
> RUN_TYPE = RUN_DEV
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
> #'NAME': 'bridge_icba',
> 'NAME': 'bridge_js',
> #'NAME': 'bridge_dfg_internal',
> #'NAME': 'bridge_dfg',
> 'HOST': 'localhost',
> 'USER': 'django',
> 'PASSWORD': 'bridge_user',
> 'PORT': '',
> },
> }
>
> MEDIA_ROOT = 'C:/Users/DavidPiccione/Dropbox/Work - 
> Bridge/Projects/bridge/MEDIA/'
> MEDIA_URL = '/media/'
>
> EMAIL_HOST = 'smtp.gmail.com'
> EMAIL_PORT = 587
> EMAIL_HOST_USER = 'bridgeautoma...@gmail.com '
> EMAIL_HOST_PASSWORD = 'bridgeautomaticmessenger123'
> EMAIL_USE_TLS = True
> DEFAULT_FROM_EMAIL = 'bridgeautoma...@gmail.com '
>
>
> STATIC_ROOT = ''
> STATIC_URL = '/static/'
> STATICFILES_DIRS = ("C:/Users/DavidPiccione/Dropbox/Work - 
> Bridge/Projects/bridge/static",)
> STATIC_PATH = 'C:/Users/DavidPiccione/Dropbox/Work - 
> Bridge/Projects/bridge/static'
>
> TEMPLATES = [
> {
> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
> 'DIRS': ["C:/Users/DavidPiccione/Dropbox/Work - 
> Bridge/Projects/bridge/TEMPLATES",],
> 'APP_DIRS': False,
> 'OPTIONS': {
> 'context_processors': [
> 'django.contrib.auth.context_processors.auth',
> 'django.template.context_processors.debug',
> 'django.template.context_processors.i18n',
> 'django.template.context_processors.media',
> 'django.template.context_processors.static',
> 'django.template.context_processors.tz',
> 'django.template.context_processors.request',
> 'django.contrib.messages.context_processors.messages',
> 'bridge.context_processors.global_settings',],
> },
> },
> ]
>
>
> USE_ASSOCIATION_BANK_ACCOUNTS = True
>
>
> **
>
> This is *settings_common* file
>
> DMINS = ()
> BRIDGE_VERSION = "3.6.1 Build 202004.4" 
>
> MANAGERS = ADMINS
>
> TIME_ZONE = 'America/Vancouver'
> LANGUAGE_CODE = 'en-us'
> SITE_ID = 1
>
> USE_I18N = True
> USE_L10N = True
> USE_TZ = False
>
> # Make this unique and don't share it with anybody.
> SECRET_KEY ='removed for privacy reason'
> SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
>
> STATICFILES_FINDERS = (
> 'django.contrib.staticfiles.finders.FileSystemFinder',
> 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'bridge.request_access.Middleware',
> )
>
> ROOT_URLCONF 

Re: Can Django (application itself) connect to MySQL via Kerberos/GSSAPI ticket instead of password?

2020-05-19 Thread Hella Nick
Mysql8.0以上的版本更改了加密规则,这可能需要你多研究一下遇到的问题。我记得需要修改Django框架中的一些源码。


在 2020年5月20日星期三 UTC+8上午9:37:33,Edward Rose写道:
>
> Hello - Does Django have any support for the web application itself being 
> able to connect to MySQL using Kerberos Authentication / GSSAPI rather than 
> a hard coded database user name and password?
>
> I have searched around the web for a while and am still trying to find a 
> way to get a Django web app itself to authenticate to a MySQL DB equipped 
> with GSSAPI plugin via Kerberos. The Django app runs off Apache started in 
> this way:
>
> k5start -u user/server@domain -f /etc/krb5.keytab -- /usr/sbin/httpd 
> -DFOREGROUND
>
> The user/server user exists on the DB with adequate permissions. Moreover, 
> on the command line this works and connects up fine:
>
> k5start -u user/server@domain -f /etc/krb5.keytab -- mysql -u user/server
>
> However, I've tried getting the web app to connect to the DB (the app 
> itself, not worrying about the user authentication yet) about a million 
> different ways. I verified the user running the web app is apache even when 
> run started up the k5start way. Nonetheless any requests are met with this 
> error:
>
> (1105, 'Client GSSAPI error (major 851968, minor 0) : gss_init_sec_context - 
> Unspecified GSS failure.  Minor code may provide more information. ')
>
>
> The settings.py configuration for the database is as follows:
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.mysql', 
> 'NAME': 'my_database',
> 'USER': 'user/server@domain',
> #'PASSWORD' : '',
> 'HOST': 'localhost', # Or an IP Address that your DB is hosted on
> 'PORT': '3306',
> }
> }
>
>
>
> Server Specs:
> Django version: 2.2.8
> Python version: 3.6.8
> OS version: RHEL 7.8 (Maipo)
> MySQL version: 10.1.45-MariaDB MariaDB Server
>
>
> I am thinking perhaps Django is just not designed to work this way? I did 
> trace some of the code in the packages Django uses to connect to MySQL and 
> it appears to be something along the lines of mysql_connect / the MySQL 
> Connector C libraries or whatnot. And from what I saw a lot of the 
> parameters the code uses following the MySQL website documentation but 
> there was one parameter 'auth_plugin' or something like that, which did not 
> seem to be implemented. Yet at the same time it would seem like getting 
> Django to connect to the DB via kerberos would be a common problem? Again, 
> this is a separate problem I'm trying to solve besides authenticating users 
> to the website, rather I'm hoping to allow the app itself to authenticate 
> to the database with kerb ticket, and had been hoping starting up apache in 
> a kerberized way might let that happen. 
>
> Any suggestions from people more Kerberos knowledgeable than I?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ceb2ce4c-7fa3-45fb-8f72-cff1329a3822%40googlegroups.com.


Django and uwsgi and nginx is log error

2020-05-08 Thread Hella Nick
我的uwsig日志显示:
   
   
clock source: unix
detected number of CPU cores: 2
current working directory: /project/work/teacher
writing pidfile to /project/work/teacher/uwsgi.pid
detected binary path: /project/env/online/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
chdir() to /project/work/teacher/
your processes number limit is 14502
your memory page size is 4096 bytes
detected max file descriptor number: 65535
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:8042 fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Python version: 3.7.1 (default, Apr 25 2020, 16:19:43)  [GCC 4.8.5 20150623 
(Red Hat 4.8.5-39)]
*** Python threads support is disabled. You can enable it with 
--enable-threads ***
Python main interpreter initialized at 0x11e7950
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 656136 bytes (640 KB) for 8 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x11e7950 pid: 
17018 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 17018)
spawned uWSGI worker 1 (pid: 17022, cores: 1)
spawned uWSGI worker 2 (pid: 17023, cores: 1)
spawned uWSGI worker 3 (pid: 17024, cores: 1)
spawned uWSGI worker 4 (pid: 17025, cores: 1)
spawned uWSGI worker 5 (pid: 17026, cores: 1)
spawned uWSGI worker 6 (pid: 17027, cores: 1)
spawned uWSGI worker 7 (pid: 17028, cores: 1)
spawned uWSGI worker 8 (pid: 17029, cores: 1)

我想知道 your server socket listen backlog is limited to 100 connections 
这个错误怎么解决掉?

Could someone help me out?


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/747311a1-4442-4ab7-b5de-a8007df85d2a%40googlegroups.com.


Re: hosting django app on app engine

2020-04-23 Thread Nick Sarbicki
I've set Django up on app engine a few times and every time it's a massive
struggle.

App engine wasn't really designed to work well with Cloud SQL as it's not a
dynamically scalable data store, it is expected that you use google
datastore (or firestore nowadays) - which isn't ideal for django as it is
non-relational.

To remedy this App Engine has been made so that it can to the Cloud SQL
instances through a proxy. But documentation on this is poor and setting up
the right environment to use this proxy feels arbitrary. There are a
several magic env vars and similar configuration options that need to be
put in to enable access.

It's been well over a year since I last did this but most times it's
involved following multiple guides to eventually get to the truth on it.
The Python 3 app engine guide when it was first released completely ignored
these steps and so was essentially broken when it came to DB setup (I get
the feeling it still is).

https://cloud.google.com/sql/docs/mysql/connect-app-engine#connecting_to
definitely hints at some of the issues. The Python 2 guide for Django did
have some guidance on it as well if you can find that. But the key thing is
that, as App Engine IPs are arbitrary, you cannot connect directly to the
database but need to tell App Engine to load up a proxy and then connect to
that instead.

Sorry I can't help much more - I wish I'd written down the steps I took
last I did this, but it's been too long for me to remember it well.

- Nick


On Wed, Apr 22, 2020 at 2:14 PM Anirudh choudhary <
anirudhchoudary...@gmail.com> wrote:

> hi to all! I am hosting my blogging app on google app engine in a standard
> environment. the website deploys successfully. but when I try to go to any
> other URL like anirudhmalik.in to anirudhmalik/blog/list/ it shows me 500
> server error on the server side I am using PostgreSQL instance and the logs
> message only show me the error
> projects/anirudhmalik-274008/logs/appengine.googleapis.com%2Frequest_log"
>
> but I couldn't get any hint from this message and none of the post
> requests is
> working on the website and everything is working fine in a local server or
> my local machine
>
> you can check the website on anirudhmalik.in
>
> and you can also give suggestion is google app engine is good to host your
> Django project
> and other cheap college student type hosting service
> thankyou
>
>
> main.py
>
> from annyportfolio.wsgi import application
>
> app=application
>
> app.yaml file
>
> runtime: python37
>
> handlers:
> # This configures Google App Engine to serve the files in the app's static
> # directory.
> - url: /static
> static_dir: static-storage/
>
>
> # This handler routes all requests not caught above to your main app. It is
> # required when static routes are defined, but can be omitted (along with
> # the entire handlers section) when there are no static files defined.
>
> - url: /.*
> secure: always
> redirect_http_response_code: 301
> script: auto
>
>
>
> env_variables:
> DJANGO_SETTINGS_MODULE: annyportfolio.settings
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAL8_rkG8qwM491qCcX18qgukA_ao4_ZjH8%2B-K01m17vOTcTTNw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAL8_rkG8qwM491qCcX18qgukA_ao4_ZjH8%2B-K01m17vOTcTTNw%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt90e1_JsC_D0A_CpAvaL0sfZYMCMaJcv9Tyhi2k7Bi%3DHDg%40mail.gmail.com.


Re: Django pdfs

2020-04-22 Thread Hella Nick
me to。do you help me?

Perceval Maturure 于2020年4月22日 周三07:31写道:

> Hi Django Users
>
> I am developing a Django document management system which will cater for
> pdf file uploads. What is the best resource to use (tutorial) as I want to
> have the pdfs accessible from admin. Can I do this with Django filer
>
> Regards
>
> Perceval
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/B912F6EC-E628-49E8-91AB-8442B25A7E34%40gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHfGPEfRLO_VqswP9sHG%2BOM_HOob%2BQw2ztgvZx3TbMd5%3Dtk50w%40mail.gmail.com.


Re: keep getting the Fatal Python error with mod_wsgi and apache

2020-03-25 Thread Hella Nick
你的服务器是安装的python3.8.2的版本吗?

Fateh Budwal  于2020年3月26日周四 上午6:03写道:

> Hello Everyone
>  I have complied python 3.8.2 with django 2.2. it run locally fine but
> when i try to deploy it with Apache and mod_wsgi 4.7.1 and getting the
> below error. Any suggestions ?
>
> Current thread 0x7f5aa48af880 (most recent call first):
> no Python framePython path configuration:
>   PYTHONHOME = (not set)
>   PYTHONPATH = (not set)
>   program name = /var/www/project/venu/bin/python
>   isolated = 0
>   environment = 1
>   user site = 1
>   import site = 1
>   sys._base_executable = /var/www/project/venu/bin/python
>   sys.base_prefix = '/opt/python3.8.2'
>   sys.base_exec_prefix = '/opt/python3.8.2'
>   sys.executable = '/var/www/project/venu/bin/python
>   sys.prefix = '/opt/python3.8.2'
>   sys.exec_prefix = '/opt/python3.8.2'
>   sys.path = [
> '/opt/python3.8.2/lib/python38.zip',
> '/opt/python3.8.2/lib/python3.8',
> '/opt/python3.8.2/lib/lib-dynload',
>   ]
> Fatal Python error: init_fs_encoding: failed to get the Python codec of the 
> filesystem encoding
> Python runtime state: core initialized
> ModuleNotFoundError: No module named encodings
>
> Current thread (most recent call first)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAOts0r0qLZLyaFczsQvdKNm45uhhRFYZPwo3uTfMK9Jmy%2B1oNQ%40mail.gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHfGPEeGWB6kdVc65d6s53M-M0KnGS0Er_PFE-pz3tSZco_cGg%40mail.gmail.com.


Re: Django IRC...Is it Active?

2020-03-20 Thread Nick Sarbicki
If you are just looking for help the #django channel on the python
developers slack workspace (pyslackers.com) is pretty active.

Full disclosure - I'm an admin of the slack workspace.

- Nick


On Fri, Mar 20, 2020 at 2:14 PM Andréas Kühne 
wrote:

> Currently the django project recommends using the forums:
>
> forum.djangoproject.com
>
> Regards,
>
> Andréas
>
>
> Den fre 20 mars 2020 kl 14:59 skrev Shishir Jha :
>
>> Yes I also want to ask for django official discord server
>>
>> On Fri, Mar 20, 2020 at 7:23 PM B.Ramburn  wrote:
>>
>>> we could use a discord server?
>>>
>>> Regards,
>>>
>>>
>>> B.Ramburn BSc LLM#
>>> Snr. Quantity Surveyor
>>>
>>>
>>> On Fri, 20 Mar 2020 at 12:04, Matthew Leung  wrote:
>>>
>>>> I tried it...there is nobody in there :(
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/dcc59e8e-2bc6-478e-85f8-63d5fa95de35%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/dcc59e8e-2bc6-478e-85f8-63d5fa95de35%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAKhymb3eu_Gzsm_DD5FOXdPT0qjhez8rZTfe6KRb38uZ6bVnOw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAKhymb3eu_Gzsm_DD5FOXdPT0qjhez8rZTfe6KRb38uZ6bVnOw%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2BC7wFQ7gBapjT%3DBqvptvGra8K5r3PFHXeP9hgC94T1eKuAd9A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CA%2BC7wFQ7gBapjT%3DBqvptvGra8K5r3PFHXeP9hgC94T1eKuAd9A%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAK4qSCdGvwcZoh3AwXY9mucudQwgNxWzqU%2BPDz4Oe%3D74qELmoA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAK4qSCdGvwcZoh3AwXY9mucudQwgNxWzqU%2BPDz4Oe%3D74qELmoA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt91oo9mApvvE5_aHBY4ODCGJ2JYVOA6BQJHO302NCQEmsQ%40mail.gmail.com.


Re: relation "django_session" does not exist

2020-02-26 Thread Hella Nick
Me to,My error was is
Traceback (most recent call last):
  File 
"D:\Python3\lib\site-packages\django\contrib\sessions\backends\base.py", 
line 190, in _get_session
return self._session_cache
AttributeError: 'SessionStore' object has no attribute '_session_cache'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dae05915-720f-45f3-9808-756c097ecdfa%40googlegroups.com.


Re: Running 2.7 python project with python 3.7

2020-02-13 Thread Nick Sarbicki
There is no natural reason as to why the project wouldn't run in python 3.7
unless you have written it in a way that is incompatible with 3.7

I would suggest simply trying to run it in python3.7 and seeing if you have
any errors. Do you have a test suite with high coverage? Run that in 3.7 -
it should be pretty revealing. On top of this

Otherwise there are guides online, including some advice here:
https://portingguide.readthedocs.io/en/latest/tools.html

I can recommend using pylint --py3k on your code as well, it will
immediately tell you of anything which won't work in 3.x.

If the code does not work in 3.7, your options are to rewrite the code so
that it does.


- Nick


On Thu, Feb 13, 2020 at 9:54 AM Luka Nik  wrote:

> Is there a way to run a project with python 3.7 if it's written with
> python 2.7?
> And what are my options if not?
> Cheers,
> Luka
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMqinds9QRA_7x5cJ4AbfzzsEpARH7NxUxYWWVf7m%3DaJD7RRMQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMqinds9QRA_7x5cJ4AbfzzsEpARH7NxUxYWWVf7m%3DaJD7RRMQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt925c_R-F2ZD8WCPXkONPKS%2BwjofM7LOTqF63y1oiYqktA%40mail.gmail.com.


Re: Getting the first item in a dict

2020-01-27 Thread Nick Sarbicki
I think the real question here is why you have a dict with one item in it?

If you can construct it so that this isn't the case that would be ideal.

If you really can't construct it any other way then you can do something
simple like my_dict.popitem()[1] to get the value of the only item in the
dict. Although it is worth noting this will also remove that item from the
dict (giving you a single non-nested dict which seems more desirable).


- Nick


On Mon, Jan 27, 2020 at 12:32 PM Mike Dewhirst 
wrote:

> Can you use ddict[ddict.keys()[0]] ???
>
> I don't know if that would show you the first item unless it was an
> ordered dict.
>
> Mike
>
>
>
>
>
>  Original message 
> From: S D 
> Date: 27/1/20 22:56 (GMT+10:00)
> To: django-users@googlegroups.com
> Subject: Getting the first item in a dict
>
> I have a dictionary which contains one item (“current_location”, which is
> a nested dict) and I would like to access that nested dict. However, I
> cannot use the key as the code will break if a different key is passed,
> e.g. “different_location”.
>
> How can I access the first item in a dictionary without using a key? The
> dict looks like this:
>
> `
> {'current_location': {'date': '2020-01-27T10:28:24.148Z', 'type_icon':
> 'partly-cloudy-day', 'description': 'Mostly Cloudy', 'temperature': 68.28,
> 'wind': {'speed': 10.48, 'bearing': 178, 'gust': 12.47}, 'rain_prob': 0.02,
> 'latitude': '-33.927407', 'longitude': '18.415747', 'request_id': 31364,
> 'request_location': 'Current location'}}
> `
>
> Kind regards,
> - SD
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAH-SnCBnnOsoTURnSzCrqqXsCWF5EEjghm9Q1UTQKrnTBAJ3iA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAH-SnCBnnOsoTURnSzCrqqXsCWF5EEjghm9Q1UTQKrnTBAJ3iA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5e2ed855.1c69fb81.32672.ad44SMTPIN_ADDED_MISSING%40gmr-mx.google.com
> <https://groups.google.com/d/msgid/django-users/5e2ed855.1c69fb81.32672.ad44SMTPIN_ADDED_MISSING%40gmr-mx.google.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt90w7nW4cGBRjX%2BDtA5%2BvHk9i17rnfwjmF8o1XOZJ_QJyA%40mail.gmail.com.


Re: Hosting a django website

2020-01-26 Thread Nick Sarbicki
It depends on the shared host. Shared hosts generally only have installed a
set of standard tools which they decide on. This may or may not include
things like python (2 or 3) and other requirements you need. A lot of the
time as a result it does not prove possible to run a Django site on shared
hosting.

On Sat, 25 Jan 2020, 18:41 Perceval Maturure,  wrote:

> dear all
> 1.what is the best way to host a django website on a shared host that you
> are not sudo?
> 2.is this possible?
> 3. any ideas?
>
> --
> *Perceval Maturure*
>
> *083 303 9423*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFZtZmBxd2%2Bd2-xxRMZGkmMjM9JhDCD%3D_Zwnsn8EZ-%3Dfi9bC5A%40mail.gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt90uHef%3DQvx2Rk6P7ZhwA2hychKg_EL3ZExR%2B7izWVuOPw%40mail.gmail.com.


Re: Best Django Deployment

2020-01-25 Thread Nick Sarbicki
As far as I'm aware the performance difference between gunicorn and uwsgi
is minimal. I prefer gunicorn but I have no real rationale for why.

For ASGI Vs WSGI, WSGI is the historical standard most things are built on
so is by far the easiest to start with. ASGI requires a fundamental change
in how you think about your web services and whilst Django does support
ASGI nowadays it is still only experimental support. As a starting point
I'd stick with WSGI, ASGI has some benefits but early on the learning
curves make WSGI the logical choice.


On Sat, 25 Jan 2020, 11:41 Motaz Hejaze,  wrote:

> Guys thank you all for all your answers ..
>
> I think i'll go with Nginx rather than Apache , Apache seems to have more
> options , but also seems old , complicated and heavy !
>
> Now i want to consider which layer of integration with web server to use ,
> i.e should i user Nginx/Gunicorn or Nginx/uwsgi ?? are there any
> performance gain ?
>
> What about running Django in an Asynchronous way , i mean using django
> with Asgi rather than Usgi ?? any performance gain too ??
>
> On Sat, Jan 25, 2020 at 1:09 PM Nick Sarbicki 
> wrote:
>
>> I've used nginx+gunicorn/uwsgi, Apache+modwsgi, Google app engine flex,
>> Google app engine standard, heroku, kubernetes on various cloud platforms,
>> elastic beanstalk deployments and various others.
>>
>> Realistically I don't think there is a "best" way. It all depends on your
>> environment, what you're working with and what you know.
>>
>> If you're new to deploying Django I'd just follow the digital ocean guide
>> with nginx and gunicorn here:
>> https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04
>>
>> It teaches you the basics of what you want to know.
>>
>> In the end every style of deployment has its ups and downs so I'd just
>> use whatever works best for you. If you don't know what that is then try
>> whatever seems simplest (in my opinion that digital ocean guide) and feel
>> free to evolve and adapt from there.
>>
>> One thing I would say though is to avoid app engine flex. It's just a
>> wrapper around Google compute engine for 6x the price. It promises
>> scalability but realistically the latency in bringing up new machines voids
>> that. Luckily the latest standard engine supports python 3 and Django and
>> is much faster so is ok to use (with a lot of work around connecting to
>> databases).
>>
>> On Sat, 25 Jan 2020, 08:06 Motaz Hejaze,  wrote:
>>
>>> I found this comparison on a blog ..
>>>
>>> Apache vs Nginx
>>>
>>> https://www.hostingadvice.com/how-to/nginx-vs-apache/
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/8fdeda69-15ad-4997-9806-31c437ee2416%40googlegroups.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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAGuvt91tse6MUmO3XhPL4iQVCzw44QzMQOA%3D-qAXMLjnmZBPOg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAGuvt91tse6MUmO3XhPL4iQVCzw44QzMQOA%3D-qAXMLjnmZBPOg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHV4E-ec7ODpS-MTE1dxyNoVSTY2ROamqCDeDHddLR4Xk1NT2g%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHV4E-ec7ODpS-MTE1dxyNoVSTY2ROamqCDeDHddLR4Xk1NT2g%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt90%3DtN4b8P%2B595X0FeXpp78bqg--aagqQ4ivo2wDJFkX0A%40mail.gmail.com.


Re: Best Django Deployment

2020-01-25 Thread Nick Sarbicki
I've used nginx+gunicorn/uwsgi, Apache+modwsgi, Google app engine flex,
Google app engine standard, heroku, kubernetes on various cloud platforms,
elastic beanstalk deployments and various others.

Realistically I don't think there is a "best" way. It all depends on your
environment, what you're working with and what you know.

If you're new to deploying Django I'd just follow the digital ocean guide
with nginx and gunicorn here:
https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04

It teaches you the basics of what you want to know.

In the end every style of deployment has its ups and downs so I'd just use
whatever works best for you. If you don't know what that is then try
whatever seems simplest (in my opinion that digital ocean guide) and feel
free to evolve and adapt from there.

One thing I would say though is to avoid app engine flex. It's just a
wrapper around Google compute engine for 6x the price. It promises
scalability but realistically the latency in bringing up new machines voids
that. Luckily the latest standard engine supports python 3 and Django and
is much faster so is ok to use (with a lot of work around connecting to
databases).

On Sat, 25 Jan 2020, 08:06 Motaz Hejaze,  wrote:

> I found this comparison on a blog ..
>
> Apache vs Nginx
>
> https://www.hostingadvice.com/how-to/nginx-vs-apache/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8fdeda69-15ad-4997-9806-31c437ee2416%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt91tse6MUmO3XhPL4iQVCzw44QzMQOA%3D-qAXMLjnmZBPOg%40mail.gmail.com.


Re: djangorestframework vs GraphQL

2019-11-12 Thread Nick Sarbicki
GraphQL strikes me as very similar to NoSQL.

Useful in niches but the older standard is better in general.

I've tried both and the added complexity (designing a system to generate
all required data from a single request) of GraphQL for the, seemingly
minor, gain (a single request for all your data) doesn't enthuse me.

It's an interesting solution to a problem I've never really had. Not to say
it isn't useful in some situations, I just haven't yet encountered a
situation where it is.

- Nick


On Tue, Nov 12, 2019 at 9:14 AM guettli  wrote:

> Hi,
>
> I am new to GraphQL, but I like the idea very much.
>
> There is already an A Django integration for Graphene:
> https://github.com/graphql-python/graphene-django
>
>
> What are the pros and cons of djangorestframework and GraphQL?
>
> Which one would you choose, if you could start from scratch?
>
> Regards,
>   Thomas Güttler
>
> PS: I am always looking for feedback for my guidelines:
> https://github.com/guettli/programming-guidelines
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f5dd3fea-28ab-4b01-9e07-0819b4bb91cb%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f5dd3fea-28ab-4b01-9e07-0819b4bb91cb%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt90HG0OE9kV9axHvkFx8xfa7qD41HdV3tuoupSKYjdG9ew%40mail.gmail.com.


Re: How t do Login using Gmail, twtter or facebook

2019-11-11 Thread Nick Sarbicki
I generally like to implement things like Google auth myself, as it's not
too complex and down the line it often makes things easier (e.g. you can
easily use a single backend for both a web login and an API login).

Google provide plenty of guides on this for their setup e.g:

https://www.youtube.com/watch?v=Oy5F9h5JqEU
https://developers.google.com/identity/sign-in/web

If you do want to just use a package, especially one with a wide range of
support for social auth then I'd recommend AllAuth. Here's the docs for
AllAuth with Google:

https://django-allauth.readthedocs.io/en/latest/providers.html#google


- Nick


On Mon, Nov 11, 2019 at 9:32 AM Andréas Kühne 
wrote:

>
> https://simpleisbetterthancomplex.com/tutorial/2016/10/24/how-to-add-social-login-to-django.html
>
> Regards,
>
> Andréas
>
>
> Den mån 11 nov. 2019 kl 10:27 skrev Balaji Shetty  >:
>
>> Hi
>>
>> can anyone give me web resource to login into Application using Gmail
>> Account.
>>
>> --
>>
>>
>> *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
>> *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
>> *Official: bsshe...@sggs.ac.in  *
>> *  Mobile: +91-9270696267*
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAECSbOu3u0X2bFadyzDZHHy1k2CtX7zaH9ogkgEdy-6s-%2Bosdg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAECSbOu3u0X2bFadyzDZHHy1k2CtX7zaH9ogkgEdy-6s-%2Bosdg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAK4qSCeFpc9A2dCxTuuaBYmhHqhBdt_s4JG3z4O0jqA-9vfAkg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAK4qSCeFpc9A2dCxTuuaBYmhHqhBdt_s4JG3z4O0jqA-9vfAkg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt91fzNLgNFN6FvvH5MK8kwhdYScH22egXRQHEqCcBeB%2Bfg%40mail.gmail.com.


Re: Microservice with django

2019-11-08 Thread Nick Sarbicki
There is not really anything that requires doing to make Django work with
microservices or as a microservice.

It is completely agnostic to your overall architecture.

Just simply create a new django project for each microservice you want to
create. There honestly is nothing else to it.

- Nick


On Fri, Nov 8, 2019 at 7:50 PM Ing.Daniel Bojorge 
wrote:

> Me too!!!
>
>
>
> Dios L@s Bendiga
>
> Saludos,
>
>
>
> [image: --]
>
> daniel.bojorge
> [image: http://]about.me/daniel.bojorge
> <http://about.me/daniel.bojorge?promo=email_sig>
>  [image: snake]*Curso Desarrollo Web con Python usando Django 2.2 Para
> Principiantes con Descuento 95% <http://bit.ly/DJFULL-BLOG12019>   *[image:
> snake]
> *WebService RestFul API con Python usando Django RestFrameWork*
> <https://goo.gl/j8i34C>
> *Fácil Replicación de Cualquier Base de Datos y/o Sistema Operativo*
> <https://goo.gl/HjtExs>
> *Programación en Capas (Web y Escritorio)* <https://goo.gl/zGZpSD>
> Mi Blog <http://debsconsultores.blogspot.com>
> Nicaragua
>
> "Si ustedes permanecen unidos a mí, y si permanecen fieles a mis
> enseñanzas, pidan lo que quieran y se les dará.
> (Juan 15:7 DHH)
> Bendito el varón que se fía en el SEÑOR, y cuya confianza es el SEÑOR.
> (Jeremías 17:7 RV2000)
>
>
>
>
> El vie., 8 nov. 2019 a las 13:26, Murilo A. Gigliotti (<
> mur...@gigliottitech.com.br>) escribió:
>
>> All,
>>
>> Good question! I would like more details... Thank you!
>>
>>
>>
>> Rgds,
>>
>> _
>>
>> Murilo Gigliotti,
>>
>> *[image: Odoo icone2] Odoo Business Partner*
>>
>> Mais informações visite http://www.gigliottitech.com.br/
>>
>>
>>
>> *De:* django-users@googlegroups.com [mailto:django-users@googlegroups.com]
>> *Em nome de *Salim Kachemela
>> *Enviada em:* sexta-feira, 8 de novembro de 2019 15:04
>> *Para:* django-users@googlegroups.com
>> *Assunto:* Re: Microservice with django
>>
>>
>>
>> I was wondering the same thing
>>
>>
>>
>> On Fri, 8 Nov 2019, 20:15 salimon jamiu olashile, <
>> tunedae1shi...@gmail.com> wrote:
>>
>> Hello all,
>>
>>
>>
>> How can I build a Django project/app that follow the microservice
>> architecture?
>>
>>
>>
>> Looking to be pointed in the right direction.
>>
>>
>>
>> Best regards.
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFhdOCNZ%2BR084HQc1FD5a%2BT%3D_umuH87haQbe%3DyD2aAT6SKtUsg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAFhdOCNZ%2BR084HQc1FD5a%2BT%3D_umuH87haQbe%3DyD2aAT6SKtUsg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CACB6%2B1-9tNHnZ8X7U_EwqQx6%2B_msMhThvOif2RBuEuNbY3QVXQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CACB6%2B1-9tNHnZ8X7U_EwqQx6%2B_msMhThvOif2RBuEuNbY3QVXQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/055701d59661%24ed290420%24c77b0c60%24%40com.br
>> <https://groups.google.com/d/msgid/django-users/055701d59661%24ed290420%24c77b0c60%24%40com.br?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMQeQjZ%3DWtKWS0nTxsFgyGJ6BFwHJUDYbz6BLFH_rnieTn_XRQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMQeQjZ%3DWtKWS0nTxsFgyGJ6BFwHJUDYbz6BLFH_rnieTn_XRQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt93KeEBDvO_4sy123SoEsmcRr973tZt%3DxmZUv9NgnVTqGw%40mail.gmail.com.


Re: Django Rest Framework and Django allauth

2019-10-15 Thread Nick Sarbicki
There is https://django-rest-auth.readthedocs.io/en/latest/introduction.html
which
goes some way to integrating the two.

Depending on how your authenticating - e.g. if you are using OAuth2, I
generally found allauth and rest auth got in the way more often then they
were helpful and building some custom solutions is not that time consuming.

But if it's more basic authentication it should be fine.


- Nick


On Tue, Oct 15, 2019 at 12:06 PM Joseph Emeka 
wrote:

> Can i use Django rest framework and Django allauth in the same project or
> either of then at a time. Am building a project that will have a mobile app
> and a website version.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/44fd3e96-9adf-4fcf-8c63-808178db4b49%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/44fd3e96-9adf-4fcf-8c63-808178db4b49%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt90OU_UihVu_0m%3DoUU6U3M%3D8HCqwvMLEj9QEwoKkLJivMw%40mail.gmail.com.


Re: Docker

2019-10-14 Thread Nick Sarbicki
K8S has a very different system of volumes which is separate from Docker.

Docs are here: https://kubernetes.io/docs/concepts/storage/volumes/

For K8S you mainly need to consider what your running K8S on, AWS, GCP, 
bare metal etc? As well as what you are storing on your volumes and if they 
only need to stick around for the lifetime of the pod, or need to be kept 
for longer.

In most cases when we are talking about file storage over the course of an 
apps lifetime (i.e. needs to persist even when deploying a new pod/version) 
the general direction is to store files in blob storage such as AWS S3. 
With Django this is pretty easy to do with django-storages (
https://django-storages.readthedocs.io/en/latest/).

In some cases this isn't possible, for instance storing large ML models 
between multiple pods - in which case you will likely need to create 
persistentVolumeClaim using something like AWS EFS which involves a bit 
more manual work.

In a few cases it may be that the data should be shipped to a database...

The right path varies wildly depending on what you think you need volumes 
for.

On Monday, October 14, 2019 at 10:43:45 AM UTC+1, vineet daniel wrote:
>
> in reference to kubernetes cluster as well? with multiple containers? 
> developer pushes the code to git and that invokes kube pipeline where does 
> volume come into picture here. I might be wrong here and that's why need 
> clarity on this. May be we are thinking differently.
>
> Regards
> Vineet Daniel
> Cell  : +918527565696
> Websites : Blog <http://vineetdaniel.blogspot.com>   |   Linkedin 
> <http://in.linkedin.com/in/vineetdaniel>  |  Twitter 
> <https://twitter.com/vineetdaniel>
>
>
>
>
> On Mon, Oct 14, 2019 at 2:40 PM Nick Sarbicki  > wrote:
>
>> You would use volumes in the same way regardless of how git is used and 
>> your CI/CD is setup.
>>
>> Documentation on volumes in docker is here: 
>> https://docs.docker.com/storage/volumes/ and for compose here: 
>> https://docs.docker.com/compose/compose-file/#volume-configuration-reference
>>
>> On Monday, October 14, 2019 at 8:15:46 AM UTC+1, vineet daniel wrote:
>>>
>>> How would one use volumes if containers are to initiated after git 
>>> merge/push ? (CI/CD setup).
>>>
>>> Regards
>>> Vineet Daniel
>>> Cell  : +918527565696
>>> Websites : Blog <http://vineetdaniel.blogspot.com>   |   Linkedin 
>>> <http://in.linkedin.com/in/vineetdaniel>  |  Twitter 
>>> <https://twitter.com/vineetdaniel>
>>>
>>>
>>>
>>>
>>> On Thu, Oct 10, 2019 at 10:13 PM Nick Sarbicki  
>>> wrote:
>>>
>>>> Don't use git inside the container, this is not the standard way of 
>>>> doing things.
>>>>
>>>> Docker has its own guide for using django with compose. This works fine 
>>>> for a single server setup: https://docs.docker.com/compose/django/
>>>>
>>>> - Nick
>>>>
>>>>
>>>> On Thu, Oct 10, 2019 at 5:09 PM vineet daniel  
>>>> wrote:
>>>>
>>>>> Use git to clone the code within the container to fetch latest copy of 
>>>>> code. 
>>>>>
>>>>> On Thu, 10 Oct 2019, 20:59 balogun tobi,  wrote:
>>>>>
>>>>>> How does one deploy an already developed django app using Docker?
>>>>>>
>>>>>> -- 
>>>>>> 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...@googlegroups.com.
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/django-users/da969e88-ccdc-4cac-9a37-6096b3704de1%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/django-users/da969e88-ccdc-4cac-9a37-6096b3704de1%40googlegroups.com?utm_medium=email_source=footer>
>>>>>> .
>>>>>>
>>>>> -- 
>>>>> 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...@googlegroups.com.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/django-users/CAJPbAW9mQwb4%2BLOuS0-3c0W0pW3Dt_GQfMhZ%3D_ZBw%2Bvn

Re: Docker

2019-10-14 Thread Nick Sarbicki
You would use volumes in the same way regardless of how git is used and 
your CI/CD is setup.

Documentation on volumes in docker is here: 
https://docs.docker.com/storage/volumes/ and for compose here: 
https://docs.docker.com/compose/compose-file/#volume-configuration-reference

On Monday, October 14, 2019 at 8:15:46 AM UTC+1, vineet daniel wrote:
>
> How would one use volumes if containers are to initiated after git 
> merge/push ? (CI/CD setup).
>
> Regards
> Vineet Daniel
> Cell  : +918527565696
> Websites : Blog <http://vineetdaniel.blogspot.com>   |   Linkedin 
> <http://in.linkedin.com/in/vineetdaniel>  |  Twitter 
> <https://twitter.com/vineetdaniel>
>
>
>
>
> On Thu, Oct 10, 2019 at 10:13 PM Nick Sarbicki  > wrote:
>
>> Don't use git inside the container, this is not the standard way of doing 
>> things.
>>
>> Docker has its own guide for using django with compose. This works fine 
>> for a single server setup: https://docs.docker.com/compose/django/
>>
>> - Nick
>>
>>
>> On Thu, Oct 10, 2019 at 5:09 PM vineet daniel > > wrote:
>>
>>> Use git to clone the code within the container to fetch latest copy of 
>>> code. 
>>>
>>> On Thu, 10 Oct 2019, 20:59 balogun tobi, >> > wrote:
>>>
>>>> How does one deploy an already developed django app using Docker?
>>>>
>>>> -- 
>>>> 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...@googlegroups.com .
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/django-users/da969e88-ccdc-4cac-9a37-6096b3704de1%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/da969e88-ccdc-4cac-9a37-6096b3704de1%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> -- 
>>> 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...@googlegroups.com .
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/CAJPbAW9mQwb4%2BLOuS0-3c0W0pW3Dt_GQfMhZ%3D_ZBw%2BvnLVxuhA%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/CAJPbAW9mQwb4%2BLOuS0-3c0W0pW3Dt_GQfMhZ%3D_ZBw%2BvnLVxuhA%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAGuvt903iPdjT%3DNu4iHun%2BkJ-O8EtH-AN7TOmhto7oShqYKsDQ%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/django-users/CAGuvt903iPdjT%3DNu4iHun%2BkJ-O8EtH-AN7TOmhto7oShqYKsDQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ecc10a91-ca14-4c84-845d-5fed90ec12f2%40googlegroups.com.


Re: Docker

2019-10-10 Thread Nick Sarbicki
Don't use git inside the container, this is not the standard way of doing
things.

Docker has its own guide for using django with compose. This works fine for
a single server setup: https://docs.docker.com/compose/django/

- Nick


On Thu, Oct 10, 2019 at 5:09 PM vineet daniel 
wrote:

> Use git to clone the code within the container to fetch latest copy of
> code.
>
> On Thu, 10 Oct 2019, 20:59 balogun tobi,  wrote:
>
>> How does one deploy an already developed django app using Docker?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/da969e88-ccdc-4cac-9a37-6096b3704de1%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/da969e88-ccdc-4cac-9a37-6096b3704de1%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJPbAW9mQwb4%2BLOuS0-3c0W0pW3Dt_GQfMhZ%3D_ZBw%2BvnLVxuhA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJPbAW9mQwb4%2BLOuS0-3c0W0pW3Dt_GQfMhZ%3D_ZBw%2BvnLVxuhA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt903iPdjT%3DNu4iHun%2BkJ-O8EtH-AN7TOmhto7oShqYKsDQ%40mail.gmail.com.


Can Django support chunked file uploads without a Content-Length header?

2019-10-02 Thread Nick Sarbicki
I'm working on a Django API which receives audio files and some extra POST 
data and then processes the file. This was initially in Flask, but Django 
suits the overall project better so we're migrating. However we've run into 
a snag.

Currently the audio file is sent via node.js, with the node-fetch library. 
The important thing about this library is that it does not set a 
Content-Length header and instead chunks the file, giving us a 
"Transfer-Encoding: chunked" header.

It seems to me that Django cannot handle this and simply reads the 
wsgi.input as blank.

To be specific about how this happens Django creates a LimitedStream using 
the wsgi.input stream and a content-length defaulting to 0 here 

.

On trying to then read the stream we hit this block 

 due 
to the limit (the content-length) being 0, which in turn causes this block 

 
to be executed rendering the input stream effectively blank.

The effect of the above is to stop Django being able to read chunked files. 
This occurs both with the development server and with gunicorn.

I did find a seemingly related bug here 
 but it seems specific to GET 
requests and is applied in middleware - which occurs after we've already 
set the nulling limit on the LimitedStream.

So I'm left wondering if this is intentional, or should it be considered a 
bug? If it is intentional, is there a workaround for this? For instance in 
werkzeug which uses a wsgi.input_terminated flag to tell whether it should 
just use the raw wsgi.input stream or use its own version of a LimitedStream
.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fb74257e-5f06-4d42-a266-2e694d831187%40googlegroups.com.


Re: best option for Front End Design in Django

2019-09-26 Thread Nick Sarbicki
Honestly whilst everyone is recommending react/angular etc. I'd argue these
are probably the worst places to start. It assumed a lot of up front
knowledge and ability in web design.

Balaji has strongly suggested that they don't have a good grasp of the
basics yet, HTML, CSS and vanilla JavaScript. Throwing out relatively
advanced JS solutions does not solve this problem.

Balaji I'd recommend picking up some basic knowledge of HTML and CSS first
- this will get you started building rudimentary websites and is essential
knowledge for practically all web development. You must learn these before
anything else.

Once you have some understanding of how these work take a basic course in
JavaScript - which is what powers most of the modern web (through using
HTML and CSS). If you start feeling comfortable with that I'd recommend
looking up a framework, React, Angular and Vue are the normal
recommendations. I'd personally go with React for the sole reason that it
is - comparatively quite simple to pick up (once you understand JavaScript)
and also very commonly used with strong community support.

In terms of turning this into an app down the road... Apps and web sites
are not directly comparable. There are multiple ways of approaching
converting a website into an app but most are relatively advanced. I would
focus on what you are doing now before thinking about that journey.


- Nick


On Thu, Sep 26, 2019 at 11:50 AM Pengyu Cao  wrote:

> Hey, how about check this,
> https://www.similartech.com/compare/angular-js-vs-react-js
>
> On Thursday, September 26, 2019 at 4:48:30 PM UTC+8, Suraj Thapa FC wrote:
>>
>> React
>>
>> On Thu, 26 Sep, 2019, 1:53 PM Balaji Shetty,  wrote:
>>
>>> Hi
>>>
>>> Can anybody please tell me what are the different options to create GUI
>>> (User Interface ) for Front End in Django.
>>>
>>> I got answer like Angularjs, Nodejs, HTML5 or CSS.
>>>
>>> Which one is easier as well as mobile compatible if we need to develop
>>> mobile App also.
>>>
>>> --
>>>
>>>
>>> *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information
>>> Technology,*
>>> *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
>>> *Official: bssh...@sggs.ac.in *
>>> *  Mobile: +91-9270696267*
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAECSbOtrT638Qv1UFdD-WKiqLr464-%3D5_O7K7vO5rHBo3m9yqg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAECSbOtrT638Qv1UFdD-WKiqLr464-%3D5_O7K7vO5rHBo3m9yqg%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2cb3770f-e754-44b2-8ff7-79dac39cd37b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2cb3770f-e754-44b2-8ff7-79dac39cd37b%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt90Mde5D6xJt5Sk1WOHwtDqorPrqvHjYn4XR5Z5WNkUTMw%40mail.gmail.com.


Re: convert python 3 to python2

2019-09-24 Thread Nick Sarbicki
I'm not convinced anyone could pay me enough to go back to Python 1...


On Tue, Sep 24, 2019 at 1:32 PM Larry Martell 
wrote:

> You can get anyone to do anything for enough money.
>
> On Tue, Sep 24, 2019 at 8:30 AM Deep Sukhwani 
> wrote:
> >
> > Thanks for the prompt reply. Did a quick cursory check with Anaconda, I
> don't think Anaconda does it. In fact Anaconda has posted a few months ago
> about Python 2's EOL (End of Life) -
> https://www.anaconda.com/end-of-life-eol-for-python-2-7-is-coming-are-you-ready/
> >
> > Also, just did a quick look at their professional services, couldn't see
> anything suggesting they will offer python 2 support beyond the python 2's
> community itself.
> >
> > --
> > Regards
> > Deep L Sukhwani
> >
> >
> > On Tue, 24 Sep 2019 at 17:53, Larry Martell 
> wrote:
> >>
> >> Anaconda, Enthought, ActiveState, Red Hat and maybe others as well.
> >> Also large companies can do their own support.
> >>
> >> On Tue, Sep 24, 2019 at 8:11 AM Deep Sukhwani 
> wrote:
> >> >
> >> > Wow, TIL there are companies selling support for Python 2? Never
> heard of it. So basically we are saying these companies will maintain there
> own version of Python programming language which will continue to be
> maintained as long as they have paid users for Python 2? I seriously doubt
> that. Or may be I am understanding it all wrong.
> >> >
> >> >
> >> > --
> >> > Regards
> >> > Deep L Sukhwani
> >> >
> >> >
> >> > On Tue, 24 Sep 2019 at 17:32, Larry Martell 
> wrote:
> >> >>
> >> >> On Tue, Sep 24, 2019 at 4:15 AM Andréas Kühne
> >> >>  wrote:
> >> >> >
> >> >> > Official access isn't denied - and python 2 will probably be
> available. The problem is that you don't get any security fixes or any
> updates at all. That in itself is a major problem. If someone is saying
> that you need to use python 2, I would strongly recommend them to not even
> think about it. All code that is written will be useless in a couple of
> years time, and need to be updated or even worse thrown away.
> >> >>
> >> >> This is totally untrue. Yes, all code should be converted to py3, but
> >> >> that is simply not happing at many companies. They will continue to
> >> >> use their py2 apps, and either support them internally or purchase
> py2
> >> >> support from one of the many companies offering it. Is that a good
> >> >> idea? No, but it's a reality.
> >> >>
> >> >> --
> >> >> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> >> >> To unsubscribe from this group and stop receiving emails from it,
> send an email to django-users+unsubscr...@googlegroups.com.
> >> >> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACwCsY4asgYPCoXVabOi4NABck-NfAsjOOsZN_1-MVQ07HZe7Q%40mail.gmail.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEMqiPeL8KMsq9d7FhZGh%2B73dY7i3rhA7kxHKjpWnMA3K83S-w%40mail.gmail.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACwCsY4Y%2BhYS_oLaUVC4pkRW-v_rrsjY38CwHR1Vv1%2Bt0gNZQA%40mail.gmail.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEMqiPe-ZOJLbiXn2Qesk-dSC%2Bw8JYcAii81ecsL%2BpV%2B_7AFfA%40mail.gmail.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACwCsY4gfoNpTBewvCo3-3z6J1WENrjkJkaxS7B160ot1cYXaQ%40mail.gmail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt91fJFPuXikEg_UwL4psaUKEBAp43K2SRAj6OG%2B7_upg4A%40mail.gmail.com.


Re: Slack community for Django

2019-07-17 Thread Nick Sarbicki
Cheers for the feedback Deep,

Sadly given the scale of the current community it would cost up to around
1.6 million USD per year to use enterprise slack.

I know some OSS communities have this enabled for free, slack has been
approached about this but have sadly declined to give pyslackers the same
privilege.

Outside of doing a huge fundraiser every year I don't think there is a
reasonable way to go about this.

Just to make a quick disclaimer, I am an admin of this slack community -
but derive no profit or benefit from it other than community engagement.

Obviously we're happy to be mentioned in conference talks. But i don't see
any real reason why we should be promoted at conferences at the moment.

This is feeling quite off topic at this point.

On Wed, 17 Jul 2019, 12:43 Deep Sukhwani,  wrote:

> Thank you, folks, for the super prompt and really helpful response.
>
>
> 
>
>
> *Two points:*
>
>1. It seems we are using the free version of Slack for
>https://pyslackers.com/web as a result of which older messages are not
>searchable. I feel (maybe I am wrong) This kind of discourages the use of
>tool given limitations that we have inherently.
>2. Tried to look for some select individuals I know are very regular
>in Django community, but couldn't find them - hence assuming it's either
>not evangelized enough (as much as our Mailing lists, IRC, etc.) and I have
>never heard of this being spoken about in any DjangoCon talks either.
>
>
> *Individual thoughts:*
>
>1. I feel being updated with the tools and technologies we use as a
>community encourages more participation in the community since the barriers
>are low and the tools are familiar for the newly evolving workforce. As a
>community we should put focussed efforts towards things of this nature
>(again, just an opinion based on experience with some communities such as
>K8s)
>
> Thank you again.
>
> --
> Deep S
>
> On Wednesday, 17 July 2019 14:16:13 UTC+5:30, Deep Sukhwani wrote:
>>
>> [I have sent this as an email to DSF via Contact Us form, cross-posting
>> it here in case this is a better place to communicate]
>>
>> Hello,
>>
>> A lot of large scale open source projects have a dedicated Slack
>> community, some examples are Kubernetes, Golang, etc.
>> Slack has become defacto communication standard given its ease of use,
>> third party integrations, bots, ability to notify people, availability
>> across the platforms, etc.
>> Do we (Django community) have it in our pipeline to have a dedicated
>> slack community?
>>
>> This question became more acute as I noticed that DjangoCon2018 and
>> DjangoCon2019 had their dedicated Slack communities but it is not open to
>> the general public (probably only attendees, organizers, volunteer, etc?)
>>
>> Thanks,
>> --
>> Deep L Sukhwani
>> ᐧ
>>
> --
> 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/628d45e5-60ab-4ecd-9cda-fa0ee9d7746f%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/CAGuvt91PAcNW5eP4_ZJ19XQeC_DvJPPSf5SMBuCs61AjAFSHSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Slack community for Django

2019-07-17 Thread Nick Sarbicki
Hi Deep,

I'm not sure if there is currently a dedicated django community (there was
an unofficial one but I believe it was converted into the yellow ant
community).

We do however have a dedicated python community with a very active Django
channel. It's linked on the PSF site here: https://www.python.org/community/

You can sign up at https://www.pyslackers.com


On Wed, 17 Jul 2019, 09:45 Deep Sukhwani,  wrote:

> [I have sent this as an email to DSF via Contact Us form, cross-posting it
> here in case this is a better place to communicate]
>
> Hello,
>
> A lot of large scale open source projects have a dedicated Slack
> community, some examples are Kubernetes, Golang, etc.
> Slack has become defacto communication standard given its ease of use,
> third party integrations, bots, ability to notify people, availability
> across the platforms, etc.
> Do we (Django community) have it in our pipeline to have a dedicated slack
> community?
>
> This question became more acute as I noticed that DjangoCon2018 and
> DjangoCon2019 had their dedicated Slack communities but it is not open to
> the general public (probably only attendees, organizers, volunteer, etc?)
>
> Thanks,
> --
> Deep L Sukhwani
> ᐧ
>
> --
> 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/CAEMqiPe%2BcZX3AW-rPNWivTzJsjh%3DNa1whV%3D3%3DeTD8z5qh%3DLbqw%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/CAGuvt908C6Wo%3DDeV23DLrH%3DfKiFC_seEncNYrNmzu2teT3g0cw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deploying a static website

2019-07-04 Thread Nick Sarbicki
The best way to deploy a static website is certainly on a bucket like s3.
Heroku is massive overkill for this.

Django is also unnecessary to host a static website. I do have a CMS that
generates and uploads static websites built with Django, but not django
actually hosting the site.

On Thu, 4 Jul 2019, 04:29 Aldian Fazrihady,  wrote:

> I have never used heroku. By the way, I am using 500 MB of S3 space. I am
> only billed 1 cent per month.
>
> On Thu, Jul 4, 2019 at 9:45 AM Django Dojo  wrote:
>
>> Thanks, but what do you think about Heroku?
>>
>> On Wednesday, July 3, 2019, Aldian Fazrihady  wrote:
>>
>>> You can also use Amazon S3 to host static website.
>>>
>>> Regards,
>>>
>>> Aldian Fazrihady
>>> http://aldianfazrihady.com
>>>
>>> On Thu, 4 Jul 2019, 09:25 Django Dojo,  wrote:
>>>
 I’m just learning Django and was trying it out, but is it better to
 deploy just using simple html, css and launch using a ftp

 On Wednesday, July 3, 2019, Aldian Fazrihady  wrote:

> Why does a static website need help from a Python web app framework
> such as Django?
>
> On Thu, 4 Jul 2019, 08:47 Django Dojo,  wrote:
>
>> I’ve created a static website in Django and i would like to know the
>> cheapest and best way to design ploy it.
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/c2c4536d-6de9-46c4-9c37-4a233f174803%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/CAN7EoAabcZpKK_fDfaoHsHikdnmjJoLTkoz8cS-Yx%2BAzBRhxvw%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/CANO9Ro_OJe1ykjVFhZrYr-bSTDzN6rOgY83FRT1LYYMVRAqTXA%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/CAN7EoAb9BK-M%2BM1wT5VpQuCQVyHXHzyVg44LyiZmOy39eKOqmw%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/CANO9Ro_6R70k5a8%3DaLVUD%3DjZLftQfKGVcfeDhQ3P_n1TAgOW%2Bw%40mail.gmail.com
>> 

Re: advantage of angular js with django??

2019-06-01 Thread Nick Sarbicki
> The biggest advantage is you can create, change or have multiple frontend
systems on different platforms without having to make changes to your
Django backend. For example you can create an AngularJS web app and a React
Native app for iOS using the same Django backend.

It's worth noting that this is an advantage of having a full fledged API
and not an advantage of using angular.

On Fri, 31 May 2019, 16:59 Joe Reitman,  wrote:

> AngularJS is a Single Page App (SPA) framework. You can use Django along
> with Django Rest API package as the backend to your Angular app. The
> biggest advantage is you can create, change or have multiple frontend
> systems on different platforms without having to make changes to your
> Django backend. For example you can create an AngularJS web app and a React
> Native app for iOS using the same Django backend.
>
> On Friday, May 31, 2019 at 2:43:25 AM UTC-5, Pradeep Singh wrote:
>>
>> What are the advantages of using AngularJS with Django?
>>
> --
> 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/eb63d6f5-5125-4e5f-882d-eaa469529323%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/CAGuvt92ecrrMdz_0Pp9A2LsNDwmCT_XcjK5wacyMPz3CcX1frA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how i can become django master ?

2019-05-31 Thread Nick Sarbicki
https://docs.djangoproject.com/en/2.2/intro/overview/


- Nick


On Fri, May 31, 2019 at 12:10 PM soroush safari 
wrote:

> hello guys. where I need to start reading Django and her reference?
>
> --
> 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/46308830-4049-4f9b-8b29-fce212c2af63%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/46308830-4049-4f9b-8b29-fce212c2af63%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAGuvt90UsjwnwHAuit0sTG3F126S31-Y0BpRiQ6H1MYh_Do_aQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: set python 3.6.8 default in my ubuntu

2019-05-22 Thread Nick Sarbicki
Hi Omar,

It is generally recommended to _not_ set python3 as your system default.
This is stated in PEP 394
<https://www.python.org/dev/peps/pep-0394/#future-changes-to-this-recommendation>.
The reasoning being there may be internal and third party processes which
still expect the default python to be 2.x. Updating the default to python3
will likely break these and could cause unexpected problems.

You can however create a virtualenv with python3 by simply running *virtualenv
env -p python3*.

It is also worth noting that as far as I know Heroku does support python3.
There is some documentation on this here
<https://devcenter.heroku.com/articles/python-runtimes>.

- Nick


On Wed, May 22, 2019 at 1:48 PM omar ahmed  wrote:

> hello ..
> just finished my first project with django but i can not publish it
> because my default python is python 2.7.12 and Heroku now does not support
> it ..
> now i installed python 3.6.8  how can i set it as default python
> version to make my projects with virtualenv ?
> 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/2dafe695-66c0-42a3-b92e-a71881401ab7%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2dafe695-66c0-42a3-b92e-a71881401ab7%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAGuvt92hrnjiMbsywLx%3D0zxN-4qsE7Z7CVybM0F7bDLK5sMOSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to make Django Project Mobile Compatible

2019-05-11 Thread Nick Sarbicki
Hi,

Django is completely naive to whether a frontend is mobile friendly or not.

You can use react or angular, you can also use many other frontend
frameworks. Django can work with all frontend frameworks. The choice is
entirely up to you.

On Sat, 11 May 2019, 08:04 Balaji Shetty,  wrote:

> Hi
>
> How can i make my Django Project view Mobile Compatible.
> Should i use Angular JS / React  . Please let me know.
>
> Thanks in Advance
>
> --
>
>
> *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
> *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
> *Official: bsshe...@sggs.ac.in  *
> *  Mobile: +91-9270696267*
>
> --
> 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/CAECSbOveKW_5aohHGKCJcVxPtwMg-wTBC8ttVRpPJc3YOA7dKg%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/CAGuvt92gdOmQSsZrW2BixcsFfc17DWbia0mfvv4rUYr7WZtyfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Website slowed down drasticaly

2019-05-06 Thread Nick Sarbicki
Hi Saurabh,

If the diminishing support was a cause of the dramatic slowdown then this
would have had to be intentionally put into the codebase. I'm almost
certain this isn't the case.

All losing support really means is that the developers no longer provide
updates and security patches. There would not be a slowdown as nothing
actually changes in your dependencies.

Sorry to say that it's almost certainly caused by a change in your code,
configuration, state, or limited by your hardware.


On Mon, 6 May 2019, 08:21 Saurabh Adhikary, 
wrote:

> Hey Sally,Alex,Scott,
>
> I'm real glad to see that , all of you are exactly pointing out the area
> of my concern. Thank you so much.
>
> The point is , there are no major change that was deployed on to the code
> since Dec'18.
> As I did mention that there has been some minor load increase of our users
> in the new year since Jan, but the change is not significant.
> (Originally we had around 2million unique people , ~5million approx approx
> users in total, and around 50K new users during this time)
> We are on MySQL 14.14  Distrib 5.1.73. My worry is if *Django support(for
> 1.8.1)* or *Python support (for 2.7.12*) diminishing is the *main reason
> for slowing down.*
> Rest, the debugging has been done, wherin we could'nt find a fault as of
> yet.
>
> My project is really big and I hence wish to seek some experience or
> concrete knowledge before investing time for upgrading Django & Python.
>
> Regards,
> Saurabh
>
> On Sunday, 5 May 2019 19:36:25 UTC+5:30, Sally Middleton wrote:
>>
>> Hi
>>
>> From a generic debugging point of view, you need to find out the root
>> cause of the performance decline. Ideally you need to isolate and test each
>> part of the system in turn and look for the one which is causing the
>> problem.
>>
>> 1. If it can be reproduced on a prod-like environment then that's really
>> great as you can make changes easily to test. Always keep a note of EXACTLY
>> what you've changed and put it back the way it was previously before your
>> next test. If you cannot reproduce that also tells you something, for
>> example it's due to data quantities or prod-hardware.
>>
>> 2. Put tracing/logging on your prod environment database and check for
>> SQL for degradation (maybe compared to your development env). Maybe all is
>> OK or one query is slow or everything is slow. Any performance issues will
>> need tuning, but it sounds like you are looking for something quite
>> fundamental.
>>
>> 3. What happened in February? Did you perform a release to Production?
>> What was in it? If you roll-back (in test environment) does it fix the
>> problem? Maybe it is a component that has been updated. Any configuration
>> changes to your web server?
>>
>> 4. If it isn't the database then it's something else. You need to isolate
>> each part of the system in turn and put on logging then check the results.
>>
>> Best regards
>> Sally
>>
>>
>> On Thursday, 2 May 2019 12:40:20 UTC+1, Saurabh Adhikary wrote:
>>>
>>> Hello ,
>>>
>>> I'm using Django version 1.8.1  and Python version 2.7.12 . Suddenly
>>> since Feb '19 there has been a drastic decrease in my website's response
>>> rate.
>>> For sure , there has been some minor increase in the no of hits, but the
>>> performance is too bad.
>>>
>>> Initially , the thought came that the hardware of the server was old ,
>>> so a new server with high configuration was bought.
>>> We have done the new indexing also on it.
>>> Still the sought for a higher performance is awaited.
>>>
>>>
>>> Is it that the Django support for 1.8.1 or Python support for 2.7.12 has
>>> reduced and that is casing the website to slow down or I am missing out on
>>> something ?
>>> Kindly help.
>>>
>> --
> 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/85afc1b7-f8bb-468d-8759-c41bf3645dce%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/CAGuvt91SYm4vNjZ-bswbCOPSPazECtqv5YX0oRXgqE%3DWPJqHAA%40mail.gmail.com.
For more options, 

Re: Website slowed down drasticaly

2019-05-03 Thread Nick Sarbicki
Saurabh what do you use for the WSGI HTTP Server (gunicorn etc.)? Worth
checking that as well to make sure it has enough workers.

In general performance problems are rarely version related. Usually it's
either a bad setup or inefficient code.

Django toolbar and most of the other suggestions will help you profile the
code but worth seeing how it is served as well.

- Nick


On Fri, May 3, 2019 at 10:21 AM Chetan Ganji  wrote:

> One more thing -
>
> All the third party resources i.e. js and css files e.g. bootstrap,
> jquery, etc;  don't fetch them from your server.
> Use CDN for those. This will help the load times a lot.
>
>
> Regards,
> Chetan Ganji
> +91-900-483-4183
> ganji.che...@gmail.com
> http://ryucoder.in
>
>
> On Fri, May 3, 2019 at 2:47 PM Chetan Ganji 
> wrote:
>
>> Hi Saurabh,
>>
>> You are welcome :)
>>
>> No 1 will give you insights about which endpoints are taking the most
>> time to load. Then, you can drill down the specific endpoints for
>> bottlenecks.
>>
>> Two more things you could try.
>>
>> 1. Remove unused/unnecessary middlewares from the middlewares list in the
>> settings.py of the project.
>> As they are executed before and after every single request, they could
>> add hugh unnecessary overhead easily.
>>
>> 2. Normally requests are processed in synchronous manner. Gunicorn has
>> aysnc worker types.
>> I did not have a need to look into it yet, but they could help speed up
>> things.
>> I would not suggest it for payment gateway endpoints. If your project is
>> a ERP/CRM type project, it could help you a little to look into it.
>> https://www.spirulasystems.com/blog/2015/01/20/gunicorn-worker-types/
>>
>> Nginx already handles requests async manner. Try combining Nginx + Async
>> worker in gunicorn.
>> You could get some boost.
>>
>>
>> Regards,
>> Chetan Ganji
>> +91-900-483-4183
>> ganji.che...@gmail.com
>> http://ryucoder.in
>>
>>
>> On Fri, May 3, 2019 at 11:00 AM Saurabh Adhikary <
>> adhikarysaur...@gmail.com> wrote:
>>
>>> Hi Chetan,
>>>
>>> 1)  Yes . We are infact trying this. Thank You.
>>> 2) *Taken*
>>> 3) We are on MySql , migration will cost a lot of man hours, which can
>>> be invested only if the result is concrete.
>>> 4) Up-gradation, that's our last resort.
>>> 5) Tried almost all. All in vain.
>>>
>>> Thanks for your inputs. :)
>>>
>>> On Thursday, 2 May 2019 17:52:11 UTC+5:30, Chetan Ganji wrote:
>>>>
>>>> Not sure about whats the issue. You could do couple of things to
>>>> understand whats the root cause of the problem.
>>>> I know they are generic guidelines. Anyone couldnt be more specific
>>>> than this.
>>>>
>>>>
>>>>1. Benchmark the time required to process each request. You could
>>>>write a middleware to track this time.
>>>>Attach starttime to each request object and read that at the time
>>>>of returning the response.
>>>>
>>>>2. Try using the django debug toolbar to see how much time it is
>>>>taking to execute the sql queries.
>>>>There might be some room for improvement as most developers dont
>>>>practice sql regularly.
>>>>https://django-debug-toolbar.readthedocs.io/en/latest/
>>>>
>>>>3. Maybe try using a different database - PostgreSQL, MySQL, etc.
>>>>
>>>>4. But if you have time for R, you could try using the different
>>>>python implementation, it is said to be faster in many cases than 
>>>> cpython.
>>>>It's not 100% compliant i.e. some packages might not work with
>>>>pypy. So please do your research before walking down this road.
>>>>https://pypy.org/
>>>>
>>>>5. Try using a different web server. If you are using Apache, try
>>>>using nginx. Also use a different wsgi server. If you are using 
>>>> gunicorn,
>>>>try with waitress or others.
>>>>
>>>>
>>>>
>>>> Regards,
>>>> Chetan Ganji
>>>> +91-900-483-4183
>>>> ganji...@gmail.com
>>>> http://ryucoder.in
>>>>
>>>>
>>>> On Thu, May 2, 2019 at 5:09 PM Saurabh Adhikary 
>>>> wrote:
>>>>
>>>>> Hello ,
>>>>>
>>>>> I'm using Django version 1.8.1  and Python version 2.

Re: Which Cloud Service Provider should be chosen to host Django Application

2019-05-02 Thread Nick Sarbicki
Hi Balaji,

I've used many cloud providers to host Django applications, they all work
fine.

They all have varying feature sets, pricing, levels of ease and
documentation.

So it really isn't for any of us to tell you which provider to use. They
all work, you just have to research them and find what price/feature
set/level of expertise required suits you best.


- Nick


On Thu, May 2, 2019 at 10:51 AM Balaji Shetty 
wrote:

> Hi
>
> I do not have any experience for cloud hosting. Can you please suggest
> Cloud Service Provider to host Django Application.
>
> My Application need Security and Salability.
>
> Many options are there like
>
>
>- PythonAnywhere. ..
>- *Heroku*. ...
>- A2 Hosting. ...
>- *AWS*. ...
>- *HostUpon*. ...
>- TMD Hosting. ...
>- DigitalOcean
>
>
> --
>
>
> *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
> *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
> *Official: bsshe...@sggs.ac.in  *
> *  Mobile: +91-9270696267*
>
> --
> 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/CAECSbOsUwWWGcNqrFPswKt6a4Byk4Zopy-9SFWjZrLZQc332Ww%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAECSbOsUwWWGcNqrFPswKt6a4Byk4Zopy-9SFWjZrLZQc332Ww%40mail.gmail.com?utm_medium=email_source=footer>
> .
> 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/CAGuvt91qa%3DaFpkisJCLSrgHq7wzr82vwnY6%3DebXkKoJ-P2AVFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django with Docker

2019-04-29 Thread Nick Sarbicki
Hi Omer,

Docker actually has docs on this itself:
https://docs.docker.com/compose/django/

- Nick


On Mon, Apr 29, 2019 at 4:19 PM Omer Ozsakarya 
wrote:

> Hello all,
>
> How are you deploying your Django applications with Docker?
> 1- Which packages, libraries are you writing into docker compose file?
> 2- Are you also using a virtual environment with docker?
>
> 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/CACGWYAFpn4XxxGjvAKkKsPi_YjYYzdzY17zrs1%3DfGKCAKMm1fA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACGWYAFpn4XxxGjvAKkKsPi_YjYYzdzY17zrs1%3DfGKCAKMm1fA%40mail.gmail.com?utm_medium=email_source=footer>
> .
> 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/CAGuvt93J5MbJqxjP6%3DfWn%3DRU_%3D0OyCu6vNFQdLNta4ZuDnAQnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: help

2019-04-29 Thread Nick Sarbicki
Hi Tosin,

The assignment tag was deprecated in 1.9 and removed in 2.0.

The details for this are here:
https://docs.djangoproject.com/en/2.0/releases/1.9/#assignment-tag

Basically it has been replaced with simple_tag. You should read the docs
for that here:
https://docs.djangoproject.com/en/2.2/howto/custom-template-tags/#simple-tags


- Nick


On Mon, Apr 29, 2019 at 3:14 PM Tosin Ayoola  wrote:

> sup guys, i'm kinda lost and need help, i'm working on an electronic
> noticeboard and course ware web app using django and i'm trying to have a
> section on the notice board to show the listed of the most read news, using
> the assignment tag, but with django ver 2.2 it seems not to be available,
> can anyone help out
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHLKn70Fo8pqWoq5SBVKohnscDHdoZmaVkSZxbXSCKWfELsJ4Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHLKn70Fo8pqWoq5SBVKohnscDHdoZmaVkSZxbXSCKWfELsJ4Q%40mail.gmail.com?utm_medium=email_source=footer>
> .
> 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/CAGuvt904dLpe0AYHTro%2BaX3JvzmSyhYXDhbus8UA3Aa5W3Hwxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Converting django app to iPhone app

2019-04-22 Thread Nick Sarbicki
The JavaScript I assume is just for frontend logic so hopefully isn't very
relevant - this will always need to be redone in the native language
(unless using something like react native).

If it only renders HTML then there is a bit of work you need to do in
python/Django land.

Think about what you want to show on your app and what data this will
require from your backend server, as well as any other way it may have to
interact with the server. Usually it will be standard CRUD operations.
Write these down.

Then find a library that will allow you to transmit this data in a
serialised format like JSON, and run the relevant operations. Usually you'd
look at something like a REST API (Django rest framework) or websockets
(channels), whatever you feel most comfortable with.

These generally work well with existing projects (django rest framework can
often be integrated with <100 LOC). Once you have that integrated there is
generally very little to think about for the backend, it's almost all about
getting the frontend to make the correct requests and deserialising the
data. Authentication often serves as a tripping point as well but there's n
solutions to the problem.

On Mon, 22 Apr 2019, 17:28 Larry Martell,  wrote:

> Yes, it only renders HTML and also has a lot of javascript.
>
> On Mon, Apr 22, 2019 at 12:25 PM Nick Sarbicki
>  wrote:
> >
> > That's the point, you don't. Assuming your backend has an effective way
> of delivering data (e.g. a REST API).
> >
> > If your Django server currently only renders HTML templates then you may
> want to consider adding an API on top of that. But the backend definitely
> does not need to be rewritten, only slightly expanded upon (using python).
> >
> > Outside of that you only need to focus on the frontend, usually with
> swift.
> >
> > On Mon, 22 Apr 2019, 16:47 Larry Martell, 
> wrote:
> >>
> >> Googling I found where someone said you could leave the back end in
> >> python and rewrite the front end in objective C or swift or rewrite
> >> the entire app in objective C or swift. Why would you need to rewrite
> >> the python back end that runs on the server?
> >>
> >> On Mon, Apr 22, 2019 at 10:27 AM Nick Sarbicki
> >>  wrote:
> >> >
> >> > Kind of...
> >> >
> >> > I've worked with several Django APIs that we use to back apps on
> Android and iOS as well as web apps.
> >> >
> >> > I generally find that's the key, make sure you can pass all the data
> along as an API and the rest is just understanding how to build a frontend
> on the platform. Django doesn't really get in the way at all at that point.
> >> >
> >> >
> >> > On Mon, 22 Apr 2019, 14:19 Larry Martell, 
> wrote:
> >> >>
> >> >> Has anyone here every taken a django web app and converted it to an
> >> >> iPhone app? If so, can you share your experiences here please?
> >> >>
> >> >> 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/CACwCsY4rDGWXMgD-pitf%3D_Z3%2BDNjLWCuGA2udmghW4diaRzamQ%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/CAGuvt91dyNb3ZvoL%3DA7NeG_wxYyC5FL4i-KmqQB5AcNY%3DvC0sw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Converting django app to iPhone app

2019-04-22 Thread Nick Sarbicki
That's the point, you don't. Assuming your backend has an effective way of
delivering data (e.g. a REST API).

If your Django server currently only renders HTML templates then you may
want to consider adding an API on top of that. But the backend definitely
does not need to be rewritten, only slightly expanded upon (using python).

Outside of that you only need to focus on the frontend, usually with swift.

On Mon, 22 Apr 2019, 16:47 Larry Martell,  wrote:

> Googling I found where someone said you could leave the back end in
> python and rewrite the front end in objective C or swift or rewrite
> the entire app in objective C or swift. Why would you need to rewrite
> the python back end that runs on the server?
>
> On Mon, Apr 22, 2019 at 10:27 AM Nick Sarbicki
>  wrote:
> >
> > Kind of...
> >
> > I've worked with several Django APIs that we use to back apps on Android
> and iOS as well as web apps.
> >
> > I generally find that's the key, make sure you can pass all the data
> along as an API and the rest is just understanding how to build a frontend
> on the platform. Django doesn't really get in the way at all at that point.
> >
> >
> > On Mon, 22 Apr 2019, 14:19 Larry Martell, 
> wrote:
> >>
> >> Has anyone here every taken a django web app and converted it to an
> >> iPhone app? If so, can you share your experiences here please?
> >>
> >> 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/CACwCsY586vT-kcP%2B6zq%2BLj6Lb70%2B1%3DscxTA-2n3HdgNESz_GOw%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/CAGuvt906j6%2BAKXiL6r1vhYXO39F3EJg5%2BxDUoZ%3D7VJj0h6cpOg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Converting django app to iPhone app

2019-04-22 Thread Nick Sarbicki
Kind of...

I've worked with several Django APIs that we use to back apps on Android
and iOS as well as web apps.

I generally find that's the key, make sure you can pass all the data along
as an API and the rest is just understanding how to build a frontend on the
platform. Django doesn't really get in the way at all at that point.


On Mon, 22 Apr 2019, 14:19 Larry Martell,  wrote:

> Has anyone here every taken a django web app and converted it to an
> iPhone app? If so, can you share your experiences here please?
>
> 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/CACwCsY6R%2BLAw5BGYZtrC%2BTJ%2B13yApo7JH6xn-fVORiOP%2BoLU%2Bg%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/CAGuvt927mPEbeN3t1uK%2BoGnNWvG0jHR0AzqKUGdnmGi2diQ%3DBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing child relations when overriding save()

2019-02-10 Thread Nick Emery
UPDATE: Finally figured it out! I ultimately did this by overriding 
`perform_create()` in my [Django Rest Framework 
view](https://www.django-rest-framework.org/api-guide/generic-views/) and 
making my changes after saving the object.

On Sunday, February 10, 2019 at 8:34:44 AM UTC-5, Nick Emery wrote:
>
> I am trying to wrap up my first app using Django (specifically Django 
> Rest Framework which may change the save behavior), but have run into an 
> issue that I haven't been able to solve for about 10 hours now.
>
> I am trying to override the save() method of a model to modify a field on 
> a bunch of child objects when it is created; however, I can't figure out 
> *any* way get the objects or ids for the children.
>
> My code looks something like:
> class Parent(models.Model):
>"""When I create this, I want the children to be modified."""
>def save(self, *args, **kwargs):
>if not self.pk:
>self._begin(*args, **kwargs)
>else:
>super(Parent, self).save(*args, **kwargs)
>
> def _begin(self, *args, **kwargs):
>super(Parent, self).save(*args, **kwargs)
>print(self.child_set.all())  # --> This gives: ""
>for i in self.child_set.all():
>i.last_name = self.last_name
>i.save()
>
> last_name = models.CharField(max_length=100)
>
>
> class Child:
>parent = models.ForeignKey(
>'Parent',
>on_delete=models.SET_NULL,
>null=True,
> )
>last_name = models.CharField(max_length=100)
>
> ANY way to modify the children when the parent is saved would be a life 
> saver (even if hacky or sub-optimal).
>

-- 
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/fb550843-22ae-46f2-9236-c44414c5eb25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing child relations when overriding save()

2019-02-10 Thread Nick Emery
The child objects are created separately beforehand with NULL parents (they 
don't have to have parents, they can be orphans). One other thing I noticed 
is that looking at the SQL statements executed by my app I can't even see 
the UPDATE on the foreign keys of the children (even though I KNOW it's 
happening because I can go look at those children and see that they do get 
updated). It's as if Django doesn't even know about this at all.

On Sunday, February 10, 2019 at 10:54:10 AM UTC-5, Shashank Singh wrote:
>
> And how?
>
> On Sun, 10 Feb, 2019, 9:23 PM Shashank Singh   wrote:
>
>> When do you create child objects??
>>
>> On Sun, 10 Feb, 2019, 9:17 PM Nick Emery >  wrote:
>>
>>> Tried this too but save() never actually gets called on the child (it 
>>> seems that the foreign key field of the child is updated at the database 
>>> level and never goes through the Django orm Child).
>>>
>>> On Sunday, February 10, 2019 at 8:37:54 AM UTC-5, Shashank Singh wrote:
>>>>
>>>> Override the save() of the child?
>>>>
>>>> On Sun, 10 Feb, 2019, 7:04 PM Nick Emery >>>
>>>>> I am trying to wrap up my first app using Django (specifically Django 
>>>>> Rest Framework which may change the save behavior), but have run into 
>>>>> an issue that I haven't been able to solve for about 10 hours now.
>>>>>
>>>>> I am trying to override the save() method of a model to modify a field 
>>>>> on a bunch of child objects when it is created; however, I can't figure 
>>>>> out 
>>>>> *any* way get the objects or ids for the children.
>>>>>
>>>>> My code looks something like:
>>>>> class Parent(models.Model):
>>>>>"""When I create this, I want the children to be modified."""
>>>>>def save(self, *args, **kwargs):
>>>>>if not self.pk:
>>>>>self._begin(*args, **kwargs)
>>>>>else:
>>>>>super(Parent, self).save(*args, **kwargs)
>>>>>
>>>>> def _begin(self, *args, **kwargs):
>>>>>super(Parent, self).save(*args, **kwargs)
>>>>>print(self.child_set.all())  # --> This gives: ""
>>>>>for i in self.child_set.all():
>>>>>i.last_name = self.last_name
>>>>>i.save()
>>>>>
>>>>> last_name = models.CharField(max_length=100)
>>>>>
>>>>>
>>>>> class Child:
>>>>>parent = models.ForeignKey(
>>>>>'Parent',
>>>>>on_delete=models.SET_NULL,
>>>>>null=True,
>>>>> )
>>>>>last_name = models.CharField(max_length=100)
>>>>>
>>>>> ANY way to modify the children when the parent is saved would be a 
>>>>> life saver (even if hacky or sub-optimal).
>>>>>
>>>>> -- 
>>>>> 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/24c7156b-6873-4cd3-952e-dc819fa72be0%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/django-users/24c7156b-6873-4cd3-952e-dc819fa72be0%40googlegroups.com?utm_medium=email_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com .
>>> To post to this group, send email to django...@googlegroups.com 
>>> .
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/8dca6561-aea1-492d-b209-a9767ce30bd0%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/8dca6561-aea1-492d-b209-a9767ce30bd0%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> 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/32b133b9-9649-4490-afb9-87beb07af1e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing child relations when overriding save()

2019-02-10 Thread Nick Emery
Tried this too but save() never actually gets called on the child (it seems 
that the foreign key field of the child is updated at the database level 
and never goes through the Django orm Child).

On Sunday, February 10, 2019 at 8:37:54 AM UTC-5, Shashank Singh wrote:
>
> Override the save() of the child?
>
> On Sun, 10 Feb, 2019, 7:04 PM Nick Emery  
> wrote:
>
>> I am trying to wrap up my first app using Django (specifically Django 
>> Rest Framework which may change the save behavior), but have run into an 
>> issue that I haven't been able to solve for about 10 hours now.
>>
>> I am trying to override the save() method of a model to modify a field on 
>> a bunch of child objects when it is created; however, I can't figure out 
>> *any* way get the objects or ids for the children.
>>
>> My code looks something like:
>> class Parent(models.Model):
>>"""When I create this, I want the children to be modified."""
>>def save(self, *args, **kwargs):
>>if not self.pk:
>>self._begin(*args, **kwargs)
>>else:
>>super(Parent, self).save(*args, **kwargs)
>>
>> def _begin(self, *args, **kwargs):
>>super(Parent, self).save(*args, **kwargs)
>>print(self.child_set.all())  # --> This gives: ""
>>for i in self.child_set.all():
>>i.last_name = self.last_name
>>i.save()
>>
>> last_name = models.CharField(max_length=100)
>>
>>
>> class Child:
>>parent = models.ForeignKey(
>>'Parent',
>>on_delete=models.SET_NULL,
>>null=True,
>> )
>>last_name = models.CharField(max_length=100)
>>
>> ANY way to modify the children when the parent is saved would be a life 
>> saver (even if hacky or sub-optimal).
>>
>> -- 
>> 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/24c7156b-6873-4cd3-952e-dc819fa72be0%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/24c7156b-6873-4cd3-952e-dc819fa72be0%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> 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/8dca6561-aea1-492d-b209-a9767ce30bd0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Accessing child relations when overriding save()

2019-02-10 Thread Nick Emery
I am trying to wrap up my first app using Django (specifically Django Rest 
Framework which may change the save behavior), but have run into an issue 
that I haven't been able to solve for about 10 hours now.

I am trying to override the save() method of a model to modify a field on a 
bunch of child objects when it is created; however, I can't figure out *any* 
way 
get the objects or ids for the children.

My code looks something like:
class Parent(models.Model):
   """When I create this, I want the children to be modified."""
   def save(self, *args, **kwargs):
   if not self.pk:
   self._begin(*args, **kwargs)
   else:
   super(Parent, self).save(*args, **kwargs)

def _begin(self, *args, **kwargs):
   super(Parent, self).save(*args, **kwargs)
   print(self.child_set.all())  # --> This gives: ""
   for i in self.child_set.all():
   i.last_name = self.last_name
   i.save()

last_name = models.CharField(max_length=100)


class Child:
   parent = models.ForeignKey(
   'Parent',
   on_delete=models.SET_NULL,
   null=True,
)
   last_name = models.CharField(max_length=100)

ANY way to modify the children when the parent is saved would be a life 
saver (even if hacky or sub-optimal).

-- 
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/24c7156b-6873-4cd3-952e-dc819fa72be0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Limiting a SubQuery based on instance's OuterRef

2019-01-30 Thread Nick Gashkov
Simon,

Thank you for fast reply! I've tried to rewrite a query using RowNumber()...

inner_subquery = queryset.objects.filter(date__gte=today, 
day_type='working_day')
inner_subquery = 
inner_subquery.annotate(row_number=Window(expression=RowNumber(), 
order_by=F('number').asc()))
inner_subquery = inner_subquery.filter(pk=OuterRef('pk'))
inner_subquery = inner_subquery.values('row_number')[:1]

outer_subquery = queryset.objects.annotate(row_number=Subquery(inner_subquery))
outer_subquery = outer_subquery.filter(row_number=OuterRef('number'))
outer_subquery = outer_subquery.values('value')[:1]

queryset = queryset.annotate(result=Subquery(outer_subquery))


...but stumbled upon a following exception:

Expression contains mixed types. You must set output_field.

Am I doing something wrong?

-- 
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/3eb689ea-873e-4dae-929b-5f2510f01c79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Limiting a SubQuery based on instance's OuterRef

2019-01-29 Thread Nick Gashkov
Hello there!

Is it possible to limit a SubQuery to a dynamic value of an instance in a 
QuerySet? I.e. I'm looking for something like:

queryset = 
model.objects.filter(field=OuterRef('field')).values('another_field')[:OuterRef('number')]

Sincerely,
Nick Gashkov

-- 
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/13c55e39-8d46-4828-b5f6-5d00c1795b50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Nullable vs empty strings

2018-05-03 Thread Nick Sarbicki
Thanks for the replies both.

I know the difference between a NULL value and an empty string :-D. My 
question was more why Django recommends _never_ using null=True on 
CharFields.

>From both replies it sounds like neither of you agree with this guideline...

On Thursday, May 3, 2018 at 2:18:32 PM UTC+1, Jani Tiainen wrote:
>
> And then you find out that Oracle implicitly converts empty strings to 
> NULLs which causes all kind of hassle. :)
>
>
> On Thu, May 3, 2018 at 3:39 PM, Ken Whitesell <kenwhi...@comcast.net 
> > wrote:
>
>> Nick,
>>
>>  A null string (string with length 0) is _not_ the same as a null 
>> field (no string). The two are distinct, and (can) serve two very different 
>> functions. 
>>
>> Take a look at this for some more detailed information: 
>> https://softwareengineering.stackexchange.com/questions/32578/sql-empty-string-vs-null-value
>>
>> Ken
>>
>>
>> On Thursday, May 3, 2018 at 5:17:35 AM UTC-4, Nick Sarbicki wrote:
>>>
>>> I just saw this in the docs: 
>>> https://docs.djangoproject.com/en/2.0/ref/models/fields/#null
>>>
>>> Suggesting that you should never set a CharField to null unless using a 
>>> unique index.
>>>
>>> Is this generally accepted? Historically I've always nulled a CharField 
>>> because using empty strings, as opposed to letting a column be nullable, 
>>> has felt very dirty to me.
>>>
>>> I would have expected (not suggesting this as a change) an empty string 
>>> to fail if the field isn't nullable.
>>>
>>> Am I on my own here?
>>>
>> -- 
>> 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/23e3a4dc-345a-4fb9-8122-0dba7b99bb4d%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/23e3a4dc-345a-4fb9-8122-0dba7b99bb4d%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Jani Tiainen
>
> - Well planned is half done, and a half done has been sufficient before...
>

-- 
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/c445d4ab-abf6-4cd6-9123-f9f2d0d8900d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Nullable vs empty strings

2018-05-03 Thread Nick Sarbicki
I just saw this in the 
docs: https://docs.djangoproject.com/en/2.0/ref/models/fields/#null

Suggesting that you should never set a CharField to null unless using a 
unique index.

Is this generally accepted? Historically I've always nulled a CharField 
because using empty strings, as opposed to letting a column be nullable, 
has felt very dirty to me.

I would have expected (not suggesting this as a change) an empty string to 
fail if the field isn't nullable.

Am I on my own here?

-- 
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/28b6a2c4-564d-4c7c-8498-9c3d5cba5958%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django won't update when i restart httpd.service on Fedora 23 virtual machine

2018-03-10 Thread Nick Saway
the site ip i use to connect to the site is not the same ip that i put the 
website files on.  when i do the below stop service,  i am still able to 
access the old version of the site. so i'm confused now. if i try to 
connect to the ip that is in the httpd.conf file, i get Bad Request 400.  

On Saturday, March 10, 2018 at 2:57:51 PM UTC-7, Nick Saway wrote:
>
> HI, I have a Django site running on a Fedora 23 virtual machine via 
> Apache,  i believe it is using mod_wsgi.  I updated the site files, and did 
> "systemctl stop httpd.service " and "systemctl start httpd.service" but the 
> old version of the site is still being served.  I went into my project 
> directory and also did "touch wsgi.py" file and then another stop/start.  
> that did not help.  finally,  i deleted the *.pyc files in my project/main 
> directory and then did a compile all, then another stop/start.  no dice.  
> can anyone give me advice on what to try next?   could it be a folders 
> permissions issue?  i did a chown/chmod  command on the project directory 
> and the virtualenv directory to make it root:apache.  not sure what else to 
> try.  there is nothing wrong in the errors_log file..
>

-- 
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/80044bd4-52dc-405f-8807-2edf0e849197%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django won't update when i restart httpd.service on Fedora 23 virtual machine

2018-03-10 Thread Nick Saway
HI, I have a Django site running on a Fedora 23 virtual machine via 
Apache,  i believe it is using mod_wsgi.  I updated the site files, and did 
"systemctl stop httpd.service " and "systemctl start httpd.service" but the 
old version of the site is still being served.  I went into my project 
directory and also did "touch wsgi.py" file and then another stop/start.  
that did not help.  finally,  i deleted the *.pyc files in my project/main 
directory and then did a compile all, then another stop/start.  no dice.  
can anyone give me advice on what to try next?   could it be a folders 
permissions issue?  i did a chown/chmod  command on the project directory 
and the virtualenv directory to make it root:apache.  not sure what else to 
try.  there is nothing wrong in the errors_log file..

-- 
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/3bf29ce9-50a8-4a6f-b894-4ce40fb584b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: javascript transpilers

2018-01-29 Thread Nick Sarbicki
Going SPA when you don't know JS is very much a baptism of fire.

Angular is personally my favourite too and essentially forces the SPA
model. But it has a much bigger learning curve compared to Vue and React
(the other two common names thrown about nowadays). The others are also
easier to not force into a SPA model.

Figure what's the minimum requirement first ;-).

On Mon, Jan 29, 2018 at 9:15 AM Andréas Kühne <andreas.ku...@hypercode.se>
wrote:

> If that is the case - I would recommend looking into creating a single
> page app - with Django restframework on the backend if you want to continue
> with Django. For the frontend you will however be required to learn some
> sort of JS framework - however this doesn't have to be THAT bad. I
> personally like angular 5 - which is written in typescript - a javascript
> based language - that actually removes most of the pain. HOWEVER JS
> knowledge is good to have anyway
>
> There are other frameworks that don't require that much JS knowledge and
> Jason suggested GWT which sounds like it could be worth a shot, as long as
> it doesn't add to much complexity. The main reason for using that would be
> a large user base, so you can get help. The python transpiled JS versions
> don't really have the greatest user base :-)
>
> Regards,
>
> Andréas
>
> 2018-01-29 0:00 GMT+01:00 Mike Dewhirst <mi...@dewhirst.com.au>:
>
>> That seems unanimous :(
>>
>> Jani asked what problem I need to solve. Without going into analytical
>> detail, all the code is serverside and now the project needs to move
>> towards AJAX for user experience reasons.
>>
>> M
>>
>> On 29/01/2018 5:44 AM, Nick Sarbicki wrote:
>>
>>>
>>> Agree with everything already said.
>>>
>>> Only thing I want to add is that while js has historically been a
>>> horrible language, the modern standards have helped rectify this. Modern js
>>> can be almost pleasant to work with nowadays.
>>>
>>> I wouldn't spend time transpiling python to js. Just try to learn js and
>>> maybe transpile from a modern standard to the browser standard. It's almost
>>> as easy as python to pick up.
>>>
>>> Django compressor helps greatly in the last case.
>>>
>>>
>>> On Sun, 28 Jan 2018, 16:49 Avraham Serour, <tovm...@gmail.com >> tovm...@gmail.com>> wrote:
>>>
>>> If you don't want and don't have the time to learn JS you may as
>>> well consider outsourcing the frontend work, I've worked in places
>>> that did just that and everybody was happy, the internal team
>>> liked python and the outsourced company people liked UX and JS.
>>>
>>> On Sun, Jan 28, 2018 at 6:09 PM, Jani Tiainen <rede...@gmail.com
>>> <mailto:rede...@gmail.com>> wrote:
>>>
>>> Hi,
>>>
>>> You don't describe to what extent you need to use JavaScript -
>>> IOW, what problem you need to solve with JavaScript?
>>>
>>> Depending you needs you might get away with basic knowledge
>>> and usage of some helpful JavaScript library/framework.
>>>
>>> On Sun, Jan 28, 2018 at 12:44 AM, Mike Dewhirst
>>> <mi...@dewhirst.com.au <mailto:mi...@dewhirst.com.au>> wrote:
>>>
>>> I have avoided javascript like the plague. However it
>>> seems I have to bite the bullet. Interestingly, there are
>>> now a number of Python -> Javascript transpilers.
>>>
>>>
>>> http://stromberg.dnsalias.org/~strombrg/pybrowser/python-browser.html
>>> <
>>> http://stromberg.dnsalias.org/%7Estrombrg/pybrowser/python-browser.html>
>>>
>>> Where would be a good place to start a discussion on the
>>> topic?
>>>
>>> I am self-employed  with multiple demands on my time so I
>>> cannot afford to allocate sufficient time to learn it let
>>> alone undertake formal Javascript training. My hope is to
>>> pick it up by osmosis and wonder if a transpiler would help.
>>>
>>> Thanks for any pointers
>>>
>>> Mike
>>>
>>> -- 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 t

Re: javascript transpilers

2018-01-28 Thread Nick Sarbicki
Agree with everything already said.

Only thing I want to add is that while js has historically been a horrible
language, the modern standards have helped rectify this. Modern js can be
almost pleasant to work with nowadays.

I wouldn't spend time transpiling python to js. Just try to learn js and
maybe transpile from a modern standard to the browser standard. It's almost
as easy as python to pick up.

Django compressor helps greatly in the last case.

On Sun, 28 Jan 2018, 16:49 Avraham Serour,  wrote:

> If you don't want and don't have the time to learn JS you may as well
> consider outsourcing the frontend work, I've worked in places that did just
> that and everybody was happy, the internal team liked python and the
> outsourced company people liked UX and JS.
>
> On Sun, Jan 28, 2018 at 6:09 PM, Jani Tiainen  wrote:
>
>> Hi,
>>
>> You don't describe to what extent you need to use JavaScript - IOW, what
>> problem you need to solve with JavaScript?
>>
>> Depending you needs you might get away with basic knowledge and usage of
>> some helpful JavaScript library/framework.
>>
>> On Sun, Jan 28, 2018 at 12:44 AM, Mike Dewhirst 
>> wrote:
>>
>>> I have avoided javascript like the plague. However it seems I have to
>>> bite the bullet. Interestingly, there are now a number of Python ->
>>> Javascript transpilers.
>>>
>>> http://stromberg.dnsalias.org/~strombrg/pybrowser/python-browser.html
>>>
>>> Where would be a good place to start a discussion on the topic?
>>>
>>> I am self-employed  with multiple demands on my time so I cannot afford
>>> to allocate sufficient time to learn it let alone undertake formal
>>> Javascript training. My hope is to pick it up by osmosis and wonder if a
>>> transpiler would help.
>>>
>>> Thanks for any pointers
>>>
>>> Mike
>>>
>>> --
>>> 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/fa0e9f0b-fece-344d-74f2-5b9470b40657%40dewhirst.com.au
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Jani Tiainen
>>
>> - Well planned is half done, and a half done has been sufficient before...
>>
>> --
>> 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/CAHn91od4EbPY210baiuJq59cf2nEue6TQ1-3wiU8auk-uLKCYQ%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/CAFWa6tJ_kfQ6RdW_d_QmXXTPt%2Bpt7HKPtnt_7eie17O60yaoaQ%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/CAGuvt90b-QZ54tvfNAKDBMUV-saEMXsb4G72gLiRSp2tzxjqKw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django 2 under python 2

2018-01-25 Thread Nick Sarbicki
Looks like a pypi "feature". You should pin your dependencies.

On Fri, 26 Jan 2018, 00:08 Mirek Zvolsky,  wrote:

> Isn't the question a little oposite, Avraham ??
>
>
>
> Dne čtvrtek 25. ledna 2018 22:42:37 UTC+1 Avraham Serour napsal(a):
>>
>> > I wonder why this is happening...
>> because django 2 doesn't support python 2
>>
>> I suggest using python 3.6
>>
> On Thu, Jan 25, 2018 at 9:50 PM, Andy  wrote:
>>
> Hi!
>>>
>>> pip inside a python2 virtualenv will try to install django 2, which aint
>>> working and will fail.
>>> I wonder why this is happening because for instance if i install ipython
>>> in that same virtualenv pip wont try to install version 6.x because its
>>> marked as python3 only. It seems django 2 is missing some soft of flag that
>>> is present at the ipython package and tells pip to install the old ipython
>>> 5.5 rather than anythin above that.
>>>
>>> Does anyone know whats causing this?
>>>
>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>>
>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to django-users...@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/eed0e673-56e9-476b-9030-b81a18c531a8%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/5d131349-e94b-4aa6-be23-092549e10b47%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/CAGuvt93kyULs4e%2BQgF_x%3DGquvWdv3vSQ7F%3DD2SzngqwAKaBqaA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [python-uk] Setting up Django on Google Cloud (basic server)

2018-01-25 Thread Nick Sarbicki
There was a discussion on a slack channel a few days ago with someone who,
suspiciously, had the same name and problem. They'd tried to set up
firewall rules (not sure they worked) and was trying to get it running via
port 80 with gunicorn. Haven't heard anything else so assuming fixed.

On Thu, 25 Jan 2018, 19:31 Matt Wheeler,  wrote:

> On Sat, 20 Jan 2018 at 14:52 Samuel Muiruri 
> wrote:
>
>> I had this issue before with AWS i remember it was just as stressful then
>> and actually can't remember what actually fixed it. I basically have a
>> clean Ubuntu VM which I followed this guide
>> https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04
>> step by step on creating and hosting django on a site.
>>
>> Every step worked smoothly until this point when I need to run the
>> command "python manage.py runserver 0.0.0.0:8000" which starts the
>> service (shown on the attached screenshot) (also is the google cloud page
>> showing the given external ip) according to this with the server waiting
>> visiting http://35.227.49.155:8000/ should bring the site or something
>> but it fails to connect i get "
>> This site can’t be reached
>>
> Have you checked the firewall rules?
> I would suggest adding a tag to your Instance and then creating a firewall
> rule for the same tag which allows port 8000 TCP ingress.
>
> See https://cloud.google.com/vpc/docs/firewalls#default_firewall_rules
> --
>
> --
> Matt Wheeler
> http://funkyh.at
> ___
> python-uk mailing list
> python...@python.org
> https://mail.python.org/mailman/listinfo/python-uk
>

-- 
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/CAGuvt90Atjz_O4Wd4MxeB70igpg%2B5nfBRg-BAgDoTMO9S%2BJG1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Will django include a simpler way to change username to email for registration in the future ?

2018-01-24 Thread Nick Sarbicki
django allauth (http://django-allauth.readthedocs.io/en/latest/overview.html)
also has a pretty good setup for this as well as a lot of other
functionality. As suggested it just takes a change in settings.py to move
to email as username (although it isn't stored that way in the DB that is
how it looks to the user).

On Wed, Jan 24, 2018 at 10:03 AM Avraham Serour  wrote:

> someone posted an app for that here w while ago:
>
> http://django-improved-user.readthedocs.io/en/latest/index.html
>
>
>
> On Wed, Jan 24, 2018 at 1:23 AM, Vijay Khemlani 
> wrote:
>
>> I have been using django-custom-user for that without any issues
>>
>> On Tue, Jan 23, 2018 at 6:43 PM, Daniel Cîrstea <
>> daniel.cirste...@gmail.com> wrote:
>>
>>> Hello. For a while I noticed that it is a struggle to extend the
>>> AbstractBaseUser in order to change user to email for registration and
>>> login. Takes time and it is a lot of code. I was wondering if django will
>>> include a simpler way of doing it ? Something simple like just changing a
>>> settings.py variable to email and boom, u can create accounts with email
>>> address.
>>>
>>> --
>>> 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/606c63a3-792a-4827-8211-1d4be998cc2a%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/CALn3ei0evyKJEEkSabqRTNOEKRnRnyLqYi1SLHyauvvE%2Bk2oPg%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/CAFWa6tLw4r-Ejk-VAeVgo-ZF2orzGtWY%2BGRYXQ2ZOcJ4YB-%2BHQ%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/CAGuvt902TVnfeLmp469qRvm4s6M02THNZcAo8tr1XwpCO%2BOzkA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Setting up Django on Google Cloud (basic server)

2018-01-20 Thread Nick Sarbicki
Hi Samuel,

You probably haven't opened access to port 8000 to the public

Try run server on port 80.

Nick.

On Sat, 20 Jan 2018, 14:53 Samuel Muiruri, <muiruri.sam...@gmail.com> wrote:

> I had this issue before with AWS i remember it was just as stressful then
> and actually can't remember what actually fixed it. I basically have a
> clean Ubuntu VM which I followed this guide
> https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04
> step by step on creating and hosting django on a site.
>
> Every step worked smoothly until this point when I need to run the command
> "python manage.py runserver 0.0.0.0:8000" which starts the service (shown
> on the attached screenshot) (also is the google cloud page showing the
> given external ip) according to this with the server waiting visiting
> http://35.227.49.155:8000/ should bring the site or something but it
> fails to connect i get "
> This site can’t be reached
> " message.
>
> For now I'm taking a break hoping I'll come up with something, also hope
> someone here who might have gone through the same or is a seasoned web dev
> might also help too.
>
> --
>
> Best Regards,
>
> Samuel Muiruri.
>
> Senior Developer @ Revorta.
>
> --
> 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/CAJZFZXrw9O-x8aV6NynHN9iEiLd%3DMZU8OpHGUeEmHXUSH9wAkw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJZFZXrw9O-x8aV6NynHN9iEiLd%3DMZU8OpHGUeEmHXUSH9wAkw%40mail.gmail.com?utm_medium=email_source=footer>
> .
> 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/CAGuvt92VGZfGjfjKVgDK0b7H%2B%3DoX7ZmfPgFcC_WNVFRMvfuHog%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Error when creating a django app in a specified folder with the same name as the app

2017-12-19 Thread Nick Gilmour
Hi all,

when I try to create a django app in a specified folder with the same name
as the app I get the following error:

*CommandError: 'my_app' conflicts with the name of an existing Python
module and cannot be used as an app name. Please try another name.*

These are the commands I'm using:
$ mkdir backend/apps/my_app
$ python manage startapp my_app ./backend/apps/my_app

Is this normal? Any ideas why is this happening?

Regards,

Nick

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


Re: Django+Haystack+Elastic issue

2017-05-25 Thread Nick Gilmour
It is related with Django's pagination...

The results per page value can be set with:
HAYSTACK_SEARCH_RESULTS_PER_PAGE = 20
in the settings.py.

I had found and defined this setting before but it wasn't working because I
had this in the HAYSTACK_CONNECTIONS dict (don't ask me why...).

I have increased it to 50 and I'm getting 50 hits.




On Thu, May 25, 2017 at 12:06 AM, Nick Gilmour <nickefo...@gmail.com> wrote:

> Thanks for the hint!
> It seems to be related with Django's pagination:
> with:
> {{ page.paginator.count }}
> and
> {{ page.paginator.num_pages }}
> I can see that I have 58 hits and 3 pages, which is correct.
> I was getting maximal 2 pages with 20 pages each.
> Now I have to check how pagination in Django works...
>
>
> On Wed, May 24, 2017 at 4:55 PM, Avraham Serour <tovm...@gmail.com> wrote:
>
>> it sounds like elastic is paginating, did you check that?
>>
>> On Tue, May 23, 2017 at 12:41 AM, Nick Gilmour <nickefo...@gmail.com>
>> wrote:
>>
>>> Hi all,
>>>
>>>
>>>
>>> I'm following an example to setup Django with Haystack and ES from here:
>>>
>>> https://krzysztofzuraw.com/blog/2016/haystack-elasticsearch-
>>> part-one.html
>>>
>>>
>>> Everything seems to be working OK except from the number of the results
>>> – they are always maximal 20. But actually a single query should give more
>>> than 50 results.
>>>
>>> So, where does this limitation come from? How can I change it?
>>>
>>> I cannot find a setting neither for haystack nor for django which
>>> prevents showing more than 20 results.
>>>
>>>
>>>
>>> Thanks,
>>>
>>> Nick
>>>
>>> --
>>> 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/ms
>>> gid/django-users/CAH-drozT6m%2Be_KX4Kni_U5nJXQp8NF8EeXb9cJo5
>>> OOhtUt1LoQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAH-drozT6m%2Be_KX4Kni_U5nJXQp8NF8EeXb9cJo5OOhtUt1LoQ%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>> 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/ms
>> gid/django-users/CAFWa6tL%3D1Hb3Ud1PXw6AgBue2oq9t1YnVLaOs0CN
>> GWqyrF36-A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAFWa6tL%3D1Hb3Ud1PXw6AgBue2oq9t1YnVLaOs0CNGWqyrF36-A%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>> 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/CAH-droxKK24FFz59tqMRB-m_hdrUcHPp4EEThZTRq31ZuuLG5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django+Haystack+Elastic issue

2017-05-24 Thread Nick Gilmour
Thanks for the hint!
It seems to be related with Django's pagination:
with:
{{ page.paginator.count }}
and
{{ page.paginator.num_pages }}
I can see that I have 58 hits and 3 pages, which is correct.
I was getting maximal 2 pages with 20 pages each.
Now I have to check how pagination in Django works...


On Wed, May 24, 2017 at 4:55 PM, Avraham Serour <tovm...@gmail.com> wrote:

> it sounds like elastic is paginating, did you check that?
>
> On Tue, May 23, 2017 at 12:41 AM, Nick Gilmour <nickefo...@gmail.com>
> wrote:
>
>> Hi all,
>>
>>
>>
>> I'm following an example to setup Django with Haystack and ES from here:
>>
>> https://krzysztofzuraw.com/blog/2016/haystack-elasticsearch-part-one.html
>>
>>
>> Everything seems to be working OK except from the number of the results –
>> they are always maximal 20. But actually a single query should give more
>> than 50 results.
>>
>> So, where does this limitation come from? How can I change it?
>>
>> I cannot find a setting neither for haystack nor for django which
>> prevents showing more than 20 results.
>>
>>
>>
>> Thanks,
>>
>> Nick
>>
>> --
>> 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/ms
>> gid/django-users/CAH-drozT6m%2Be_KX4Kni_U5nJXQp8NF8EeXb9cJo
>> 5OOhtUt1LoQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAH-drozT6m%2Be_KX4Kni_U5nJXQp8NF8EeXb9cJo5OOhtUt1LoQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>> 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/CAFWa6tL%3D1Hb3Ud1PXw6AgBue2oq9t1YnVLaO
> s0CNGWqyrF36-A%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAFWa6tL%3D1Hb3Ud1PXw6AgBue2oq9t1YnVLaOs0CNGWqyrF36-A%40mail.gmail.com?utm_medium=email_source=footer>
> .
> 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/CAH-drox%3DoagV96eD7v0yM%2BxcvivaZS%3DCEkvOFZVBcGkJmtJGug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django+Haystack+Elastic issue

2017-05-22 Thread Nick Gilmour
Hi all,



I'm following an example to setup Django with Haystack and ES from here:

https://krzysztofzuraw.com/blog/2016/haystack-elasticsearch-part-one.html


Everything seems to be working OK except from the number of the results –
they are always maximal 20. But actually a single query should give more
than 50 results.

So, where does this limitation come from? How can I change it?

I cannot find a setting neither for haystack nor for django which prevents
showing more than 20 results.



Thanks,

Nick

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


Re: View Function Signature?

2017-05-14 Thread Nick Gilmour
>
> Neither one of these is what was being asked for.


I didn't say I have found what I was looking for.

All answers are sufficient to me for now. Thanks.

On Sun, May 14, 2017 at 10:51 PM, James Bennett <ubernost...@gmail.com>
wrote:

> On Sun, May 14, 2017 at 1:36 PM, Nick Gilmour <nickefo...@gmail.com>
> wrote:
>
>> Definition of url:
>>
>> *def url(regex, view, kwargs=None, name=None):*
>>
>> I also found this:
>> *def view(request, *args, **kwargs):*
>>
>>
> Neither one of these is what was being asked for.
>
> And like several people have said, what's being asked for doesn't exist: a
> Django view is defined as a callable Python object which takes as its first
> position argument an HttpRequest object, may or may not accept additional
> positional and/or keyword arguments, and either returns an HttpResponse
> object or raises an exception. That definition does not allow for a single
> universal argument signature that will work on all views.
>
> --
> 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/CAL13Cg-GaiFF9E4in7vfaSd6zbiQkSsLRbpXe
> 5Y6YR0KGeKJ_Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAL13Cg-GaiFF9E4in7vfaSd6zbiQkSsLRbpXe5Y6YR0KGeKJ_Q%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
> 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/CAH-drow2ebTVu2x2Q3zAO0e228-7V6L_6wQXWJNrRt15s7Sx-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: View Function Signature?

2017-05-14 Thread Nick Gilmour
Definition of url:

*def url(regex, view, kwargs=None, name=None):*

I also found this:
*def view(request, *args, **kwargs):*

here:

*.../django/views/generic/base.py*


On Sat, May 13, 2017 at 11:15 PM, Daniel Roseman 
wrote:

> On Friday, 12 May 2017 15:11:55 UTC+1, nickeforos wrote:
>>
>> Thanks for the link. I understand these examples but still I would like
>> to see how a view function is defined.
>>
>> I also would like to see it in PyCharm. When I click on a view function
>> in PyCharm I only see:
>>
>> def myview_function(request)
>> Inferred type: (request: Any) -> HttpResponse
>>
>> I would expect to see something like this:
>> view_function(request, *args, **kwargs)
>>
>> I've also looked in django's source but I cannot locate it.
>>
>
>
> But this isn't how Python works. You don't need a defined signature or
> prototype for a class of functions. A view is simply called with the
> request and any parameters passed from the URL, that's all there is to it.
> --
> DR.
>
> --
> 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/ec6a2b04-dc19-4a72-aac6-74b20dd3e730%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/CAH-drox%3DrPnXLTjFbJhkDVBdr-%2BKQTiGoNLj%2BDWOKr5-PK6W9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: View Function Signature?

2017-05-12 Thread Nick Gilmour
Thanks for the link. I understand these examples but still I would like to
see how a view function is defined.

I also would like to see it in PyCharm. When I click on a view function in
PyCharm I only see:

def myview_function(request)
Inferred type: (request: Any) -> HttpResponse

I would expect to see something like this:
view_function(request, *args, **kwargs)

I've also looked in django's source but I cannot locate it.

On Fri, May 12, 2017 at 3:05 PM, nickeforos  wrote:

> I'm following the django tutorials and documentaion as well as the django
> book.
> In
> https://docs.djangoproject.com/en/1.11/topics/http/views/
> there is this view function:
> def current_datetime(request):
> now = datetime.datetime.now()
> html = "It is now %s." % now
> return HttpResponse(html)
>
> and in:
> http://djangobook.com/django-views-dynamic-content/http://
> djangobook.com/django-views-dynamic-content/
> there is this view function:
> def hours_ahead(request, offset):
> try:
> offset = int(offset)
> except ValueError:
> raise Http404()
> dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
> html = "In %s hour(s), it will be  %s." % (offset, dt)
> return HttpResponse(html)
>
> So in the view function I can pass *request* as well as an *argument*
> from the url but how does the signature of a view function look like?
> Where can I find it in the documentation?
> Is it possible to see such signatures in PyCharm?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+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/76227b4e-5de3-4ca1-a9c6-658c2ee69529%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/CAH-droyZRQNwUA39G7y9fgcodtFoO_pn1OTgO0s1ANDsn0pRtw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: HELP - Writing your first Django app, part 1

2016-10-16 Thread 'Nick Bansal' via Django users
Cheers! got it!

On Friday, 14 October 2016 22:45:05 UTC+1, Asad Jibran Ahmed wrote:
>
> Just save the file inside the *poll *folder. That creates the file.
>
> Asad Jibran Ahmed <surf...@gmail.com >
> http://blog.asadjb.com
>
> On Fri, Oct 14, 2016 at 9:55 PM, 'Nick Bansal' via Django users <
> django...@googlegroups.com > wrote:
>
>> I tried to create a new file (im using sublime text) but it just gave me 
>> a new tab...
>>
>> How do I create a new file in an app?
>>
>> On Friday, 14 October 2016 17:41:43 UTC+1, Asad Jibran Ahmed wrote:
>>>
>>> Just create a new file in whatever text editor you're using (I suggest 
>>> Sublime Text if you're looking for options) and save the file as urls.py 
>>> inside the polls directory.
>>>
>>> Asad Jibran Ahmed <surf...@gmail.com>
>>> http://blog.asadjb.com
>>>
>>> On Fri, Oct 14, 2016 at 8:00 PM, 'Nick Bansal' via Django users <
>>> django...@googlegroups.com> wrote:
>>>
>>>> Hi, 
>>>>
>>>> I'm struggling to figure out how to do the following command:
>>>>
>>>> "To create a URLconf in the polls directory, create a file called 
>>>> urls.py. Your app directory should now look like:"
>>>>
>>>> How do I create a file called urls.py in the app directory? am I 
>>>> missing something completely obvious?
>>>>
>>>> Any help would be appreciated
>>>>
>>>> -- 
>>>> 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/4ca2fd83-cf96-45d6-9fd1-5721de06247c%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/4ca2fd83-cf96-45d6-9fd1-5721de06247c%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/512287a4-e411-4438-b131-38ab9ffad239%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/512287a4-e411-4438-b131-38ab9ffad239%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>> 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/2ca2a31e-0994-4107-a6a6-2024a620eec6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: HELP - Writing your first Django app, part 1

2016-10-14 Thread 'Nick Bansal' via Django users
I tried to create a new file (im using sublime text) but it just gave me a 
new tab...

How do I create a new file in an app?

On Friday, 14 October 2016 17:41:43 UTC+1, Asad Jibran Ahmed wrote:
>
> Just create a new file in whatever text editor you're using (I suggest 
> Sublime Text if you're looking for options) and save the file as urls.py 
> inside the polls directory.
>
> Asad Jibran Ahmed <surf...@gmail.com >
> http://blog.asadjb.com
>
> On Fri, Oct 14, 2016 at 8:00 PM, 'Nick Bansal' via Django users <
> django...@googlegroups.com > wrote:
>
>> Hi, 
>>
>> I'm struggling to figure out how to do the following command:
>>
>> "To create a URLconf in the polls directory, create a file called urls.py. 
>> Your app directory should now look like:"
>>
>> How do I create a file called urls.py in the app directory? am I missing 
>> something completely obvious?
>>
>> Any help would be appreciated
>>
>> -- 
>> 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/4ca2fd83-cf96-45d6-9fd1-5721de06247c%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/4ca2fd83-cf96-45d6-9fd1-5721de06247c%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> 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/512287a4-e411-4438-b131-38ab9ffad239%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


HELP - Writing your first Django app, part 1

2016-10-14 Thread 'Nick Bansal' via Django users
Hi, 

I'm struggling to figure out how to do the following command:

"To create a URLconf in the polls directory, create a file called urls.py. 
Your app directory should now look like:"

How do I create a file called urls.py in the app directory? am I missing 
something completely obvious?

Any help would be appreciated

-- 
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/4ca2fd83-cf96-45d6-9fd1-5721de06247c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advice on python version for new project

2016-08-15 Thread Nick Santos
I'd recommend Python 3 at this point unless you encounter a good, specific
reason to use Python 2. If you use the six <https://pythonhosted.org/six/>
module, it's really easy to write code that can be used for both versions
without writing conditionals everywhere. If you then encounter something
that forces you to use Python 2, you can downgrade without trouble. But if
this application has anything close to the lifespan of the previous one,
you'll want to be using Python 3 if at all possible. That's without
mentioning the other benefits of Python 3 too!

-Nick <n...@enviroconsumer.org>

On Mon, Aug 15, 2016 at 12:37 PM, Rich Shepard <rshep...@appl-ecosys.com>
wrote:

>   The django web site suggests that new projects use python3 unless
> required
> dependencies are not yet available for that version. I've no idea what
> python dependencies I'll need for this job.
>
>   What I want to do is convert an abandoned php application (last upgraded
> a
> decade ago) to django. The application is XRMS, an open source CRM (client
> relationship manangement tool in my case) that is perhaps the only one that
> supposedly supported postgresql via adodb. What I learned over the weekend
> is that I cannot even install it and cannot find the reason why it's not
> connecting to the db back end.
>
>   A posting on a forum thread from 2007 reported that postgres was not
> supported unless all extensions (none of which I need) are installed, and
> all those extensions are hard coded for mysql. I have source code, schema,
> and a very full set of docs; suprizingly complete.
>
>   I suppose there's no reason to not use python-2.7.5 installed here for
> this project, unless you advise me otherwise. I also need some advice and
> guidance on how to proceed on creating a django application from the php
> source files.
>
> TIA,
>
> Rich
>
>

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


Possible bug with UploadedFile and form validation?

2016-06-13 Thread Nick Sarbicki
I've got an odd bug in my system, and while I'm not 100% convinced it is a 
Django bug, I don't think it is due to me either so thought I'd ask here 
for some clarification.

Essentially if you upload a file to a form. If that forms clean() method 
reads that file (in my case it gathers data and makes sure it is valid), 
and the clean fails, a ValueError is always raised.

ValueError at /

I/O operation on closed file.


As far as django is concerned this is happening in the template at:

31{% if form.non_field_errors %}
32{{ form.non_field_errors|striptags 
}}
33
34{% endif %}


Admittedly, I am wrapping this in a TextIOWrapper.

Example below is a good example of what I'm doing:


def clean(self):

cleaned_data = super(ReportScheduleForm, self).clean()

file = TextIOWrapper(self.cleaned_data['uploaded_file'].file, 
encoding='utf-8')

self.cleaned_data['ids'] = []
try:
reader = csv.DictReader(file)
except KeyError:
# File doesn't exist, which will raise its own error.
pass

try:
for row in reader:
if row['col_name']:
self.cleaned_data['ids'].append(row['col_name'])
except KeyError:
raise ValidationError('The file must be a csv with a column 
title col_name.')


What I gather is happening is that this clean function is run on the POST 
request. During this call the file is read through and errors, during which 
it is *closed*. After when trying to display the non_field_errors the file 
is still closed and therefore raises the error.

Is this a bug? Should the file be forced to close at this point? Or am I 
missing something important?

-- 
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/8a1ad6c9-0e24-4aa6-8d47-c87c0ea76805%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Deploying a Django 1.9 project

2016-04-12 Thread Nick Jenkins
I've been developing a site with Django 1.9 with Python3 and I'm hitting a 
wall when trying to deploy it to a hosting service. I currently have a 
shared service plan through BlueHost and I'm having trouble getting 
everything to work right. In talking with BlueHost they stated they only 
support Python 2.7 and Django 1.4. So, I'm trying to determine how best to 
proceed.

After reading many old walkthoughs on Django installs here's is what I've 
tried so far:
1. I was able to get Python 3.5 and Django 1.9 installed as a local source. 
Then after an error 500 page, I realized FastCGI was not longer supported.
2. Then after many linking errors I was able to get mod_wsgi installed with 
Python3.5 having shared libraries. The trouble is BlueHost shared services 
doesn't have root access.

(That list seems so short when compared to the actual time and number of 
tries it took to get this far)

I guess the question I'm trying to ask is: Should I switch hosting 
companies, stay with Bluehost and upgrade to a VPS or am I missing 
something simple in the configuration and I can actually get this whole 
mess to work?

Any help would be appreciated.

-- 
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/85426dfd-5252-4a02-9b21-6eb07d3b6b45%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to create a project in django in windows 7

2015-09-15 Thread Nick Sarbicki
>
> I am a fresher to django... can any one explain me how to install django.
> and what all are the requirement needed. I tried by searching google still
> am not able to do it. So any one please help me.
> Tank you.


Hi Santhosh,

Have you installed Python? (2.7 or 3.4 is best right now - 3.5 has just
been released but there seems to be some bugs with the windows install).

If you have, and it is the latest version of 2.7 or 3.4, try opening up a
command prompt window and typing in:

*pip install django*

That would normally install it for you.

If that doesn't work send any error messages you receive.

Here are the formal instructions to install Django:

https://docs.djangoproject.com/en/1.8/intro/install/

And here is the tutorial for getting started on a project:

https://docs.djangoproject.com/en/1.8/intro/tutorial01/

They are both pretty good so give them a read.

- Nick.



- Nick

On Tue, Sep 15, 2015 at 5:47 AM, Santhosh Acharya <santhoshnitt...@gmail.com
> wrote:

> I am a fresher to django... can any one explain me how to install django.
> and what all are the requirement needed. I tried by searching google still
> am not able to do it. So any one please help me.
> Tank 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4c5614d9-9c77-4338-acc6-1831f79abc23%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4c5614d9-9c77-4338-acc6-1831f79abc23%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt93cSyDEd1DWRWCELYQb8BMds%3DSZiBpSotpXvCBNgBhNww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


  1   2   3   4   5   6   7   >