Re: Django credit card redaction app - - MultiValueDictKeyError

2019-03-15 Thread Ahmed Ishtiaque
Hello drone4four,

Here are my opinionated responses on your questions.

1. What you have in your view is pythonic enough. That's the right way to
look up a value in a dict, and it's easy to understand. However, the way I
prefer to do things, I'd say that whenever someone enters a credit card
number, make a POST request to the view rather than a GET request. This
intuitively makes sense to me because I know for sure that the POST request
that's being parsed in a certain view should contain exactly the data I
want it to contain, rather than trying to figure out from a GET request
whether the data is present there. Also, since you're using an example
credit card app, I'd point you to paying attention towards your address bar
right after you make the GET request. It will contain the credit card
number in it. This can be a security issue when you're dealing with forms
in a practical sense with django. So, as far as I'm concerned, the more
"Django-esque" way is to make your credit card number submission a POST
request to the appropriate view.

2. As far as getting responses, I think it's always better the more code
you share for us to look at. For example, I just saw that you had a repo
setup for people to check out. I think that's a pretty good way to go. Of
course, if you have a private repo and don't want to give all your code
away, we understand that. In that case generally posting the code like you
did before should be fine and we'll try to help you out.

Hope your experience with django continues to be meaningful in the future!

Ahmed


On Thu, Mar 14, 2019, 7:22 PM drone4four  wrote:

> Thank you Ahmed for this clarification. This makes sense.
>
> I have two further questions for you (or anyone else still reading this
> thread):
>
>
>1.
>
>Is there a way of checking for the presence of the data with GET which
>is more Pythonic and aligns with better practices?
>
>
>
>1.
>
>On an unrelated note, I attempted to reduce my issue in this testcase
>as best I could. I think I did an OK job. But would there be a better way
>for me to ask my question to attract more responses? What would any of you
>recommend in terms of advice for me to refine and refine the way I ask
>similar questions in the future on this message board?
>
>
>
> On Thursday, March 14, 2019 at 2:13:35 PM UTC-4, Ahmed Ishtiaque wrote:
>>
>> When a user requests your home page's URL the first time in order to load
>> your home.html file, the GET request they send to your server does not
>> contain the 'ccEntry' parameter, which raised the MultiValueDictKeyError
>> whenever your view was executing. However, in your edited view, you take
>> care of that by first checking whether the GET request contains 'ccEntry',
>> which is why it is working correctly now.
>>
>> On Thu, Mar 14, 2019 at 9:57 AM drone4four  wrote:
>>
>>> I’ve discovered a ‘hack’ to correct the issue. I committed and pushed my
>>> changes up to my GitHub repo for those curious enough to try it out
>>> yourself.
>>>
>>> My problem now is that I don’t really understand why it works. Here I
>>> will explain what I do know and then my ask would be for you people to fill
>>> in the gaps in my explanation.  First I share my working code.
>>>
>>> Here is my views.py which includes the relevant function I use:
>>>
>>> from django.http import HttpResponse
>>>
>>>
>>>
>>> from django.shortcuts import render
>>>
>>>
>>> def home(request):
>>>
>>>if 'ccEntry' in request.GET:
>>>
>>>number = request.GET['ccEntry']
>>>
>>>redacted_num = '   {}'.format(number[-4:])
>>>
>>>return render(request, 'home.html', {'number':number,
>>> 'redacted_num':redacted_num})
>>>
>>>else:
>>>
>>>return render(request, 'home.html')
>>>
>>>
>>>
>>>
>>> Here is my lucid, cerebral explanation of the above Python code in plain
>>> English: At line 4 I am defining the `home` function. Then there is a
>>> conditional referring to the ‘ccEntry’ string inside the template. If
>>> ccEntry is present in the GET request, then a `number` variable is declared
>>> based on the user input on the web page. Then a `redacted_num` variable is
>>> declared which will appear as a string (‘   ’ with the last 4
>>> characters lopped off (the slice). If all of the above is in order, then
>>> the render function will be returned:
>>>
>>>-
>>>
>>>with the standard request,
>>>-
>>>
>>>with reference to the home.html template,
>>>-
>>>
>>>along with a dictionary with a ‘number’ string matching up with the
>>>`number` variable. Ditto for the redact_num.
>>>
>>> However if the above condition is false, then the render function will
>>> return the standard request and home.html template without a dictionary.
>>> That’s pretty much everything I understand.
>>>
>>> I’m not sure why a conditional as it appears above is necessary.
>>>
>>> Would someone here care to explain, if you can?
>>>
>>>
>>> On Thursday, March 7, 2019

Rename column headers with python DictWriter

2019-03-15 Thread BIJAL MANIAR


Hi,

Using Python DictWriter can we rename the column names?

Need to rename headers in CSV file so that output looks like. Basically 
need to rename database fieldnames like emp_name, emp_role to 
Name,Designation:
*Name, Designation*
ABC, IT
DEF, Admin

I am using Python DictWriter in django view and below is the snippet:

def export_csv(request):
data = [
{'emp_name': 'ABC', 'emp_role': 'IT'},
{'emp_name': 'DEF', 'emp_role': 'Admin'}
]
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="export.csv"'

*fieldnames = ['emp_name', 'emp_role']*
writer = csv.DictWriter(response, fieldnames=fieldnames, 
extrasaction='ignore')
writer.writeheader()
for row in data:
writer.writerow(row)
return response



Thanks,

Bijal


-- 
You received this message because you are subscribed 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/3b805ab5-5214-4258-97e0-e7d2388baf21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Looking for a Django co-founder

2019-03-15 Thread Varnan Thirugnanasambandan
Hi,
Nice to see your mail.
place of work ?

regadrs
varnan
chennai

On Fri, Mar 15, 2019 at 10:17 AM Anh Nguyen  wrote:

> Hi Zack, it’s good to see your post.
> Now I think i can do that.
> You can check my own blog and production in ‘adaoalive.com’ and ‘
> chuthe.com’.
> Thanks.
>
> On Fri, Mar 15, 2019 at 10:41 AM Zack Amaral 
> wrote:
>
>> Django users,
>>
>> I'm looking for a Django developer that can commit to working 10 hours a
>> week on the weekend. We work Friday and Saturday at 12AM EST. I'm looking
>> to bring on another developer that's willing to work for equity in my
>> company. We are building a web application similar to twitch.tv. We are
>> using React for the front end and Django for the backend. Everything is on
>> AWS. I can go into more details if you are interested. I can also send you
>> a copy of my business plan.
>>
>> If you are interested please let me know and I'll set up a call with you
>> to see if it's a good fit.
>>
>> Thank you for your time,
>>
>> Zack
>>
>> --
>> You received this message because you are subscribed 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/ed9c69bc-e3b0-4cfb-9a7b-f78a80393e95%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/CAKaoNbSDcaqGteeELjAiTOvzf5%2Bi_UPhPbJ%2BbNz%3Di77FNQ3mPw%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/CABH7NkQZJTRxQSgqewxH17ZV_sRDez7A0aUB2yiJxVN8rp1v5w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Looking for a Django co-founder

2019-03-15 Thread Raghuram Karra
Hi Zach,

I am a Django developer with 8 months of experience. Please let me know if 
i can be of some help.

On Friday, March 15, 2019 at 9:10:33 AM UTC+5:30, Zack Amaral wrote:
>
> Django users,
>
> I'm looking for a Django developer that can commit to working 10 hours a 
> week on the weekend. We work Friday and Saturday at 12AM EST. I'm looking 
> to bring on another developer that's willing to work for equity in my 
> company. We are building a web application similar to twitch.tv. We are 
> using React for the front end and Django for the backend. Everything is on 
> AWS. I can go into more details if you are interested. I can also send you 
> a copy of my business plan.
>
> If you are interested please let me know and I'll set up a call with you 
> to see if it's a good fit.
>
> Thank you for your time,
>
> Zack
>

-- 
You received this message because you are subscribed 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/967a1e2e-05f4-4585-b7b2-045a0c30de39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


test if model object fits into QuerySet without executing SQL?

2019-03-15 Thread Thomas Klopf
Hi all,
  Please I have a question, couldn't find any answer for it..

  Let's say I have 2 QuerySets:
  1) Select all records from table
  2) Select all records from table where color = "blue"

So QuerySet #2 is more restricted than QuerySet #1

So question is - if I get a model object from QuerySet #1, is it possible 
to check if the model object is 'filtered'  or fits into QuerySet #2, 
without actually executing the SQL for QuerySet #2 to find the record again?

I'm asking because running the SQL for QuerySet #2 is expensive, ideally 
would test if the record fits into the QuerySet in purely python/django.

Thanks in advance!
Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/64c7da25-67e2-498b-ba6c-4997122adf1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What step am I missing?

2019-03-15 Thread Pedro Folch
Your cms line should be in the same directory as the manage.py

On Thu, Mar 14, 2019, 8:46 PM Joseph Jones  wrote:

> Hi,
> yes Thank you so much those video tutorial helped me quite a bit. I was
> able to create a new directory, as the "introduction to django" tutorial
> suggested I've made sure its title is project specific. However, I seem to
> have run into a problem creating a path to my new directory. when last I
> ran the command I received an Command error stating that my project name
> was not valid. Any thoughts on what detail I am overlooking would be very
> appreciated,
> Thank you
>
> On Tue, Mar 12, 2019 at 8:30 AM Suresh Kannan  wrote:
>
>> Hi,
>>
>> You can watch these videos. I think this might help you.
>>
>> https://www.youtube.com/watch?v=FNQxxpM1yOs (windows)
>>
>>
>> https://www.youtube.com/watch?v=oT1A1KKf0SI&list=PLxxA5z-8B2xk4szCgFmgonNcCboyNneMD
>> (linux)
>>
>> On Mon, 11 Mar 2019 at 09:35, Joseph Jones  wrote:
>>
>>> Thank you so much, does one bring up the cd command in the python
>>> terminal?
>>>
>>> On Mon, Mar 11, 2019 at 8:07 AM Kayode Oladipo 
>>> wrote:
>>>
 You have to be in the project level directory to access 'manage.py'.
 Use the 'cd' command in the terminal to do this.

 On Sun, Mar 10, 2019, 23:23 Joseph Jones >>>
> Hello all!
> I have been reading
> https://www.packtpub.com/application-development/learn-python-programming-second-edition
>  Since
> November, so I am very much new to the Python community. I am currently on
> chapter 14 "Web development" which suggests completing the tutorial on
> djangoproject.com after installing Django of course. When I've run
> the first two commands in the cmd of my PC I get the output the tutorial
> would indicate. However when I run the command .../> py manage.py 
> runserver
> I receive a command error that no such file exists. My question is what
> mistake am I making? I'm hypothesizing one is to create a file entitled
> "manage.py' before beginning, however unless I'm misreading the text in 
> the
> tutorial the command .../> django-admin startproject runserver
> auto-generates said file. Any suggestions on what I'm doing wrong would be
> immensely appreciated. Let me apologize in advance if I either, ask for
> clarification in any responses(again I am new), or mess up again through
> out the course of the tutorial and again reach out to the community. Thank
> you for any help,
> Joseph
>
> --
> You received this message because you are subscribed 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/CAJGsC5OzcyMwrW%3D-EmU%2B-3o8esQ2JeVQoJScq%3DHy_mtsxKRuKQ%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/CA%2BARzD8BiTZ8Rzfi9twFF7GTzYpBZqpCdpR3K_tGW5b1Rfsdrw%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/CAJGsC5N2poHoALgwHLkk%3D9o9jGeUZ1NStedbnBS-oLdYgVzSQA%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> You received this message because you are subscribed to the Goo

Re: What step am I missing?

2019-03-15 Thread Pedro Folch
Also try using pycharm it will probably be easier for running django.  It
helps.

On Thu, Mar 14, 2019, 9:22 PM Pedro Folch  wrote:

> Your cms line should be in the same directory as the manage.py
>
> On Thu, Mar 14, 2019, 8:46 PM Joseph Jones  wrote:
>
>> Hi,
>> yes Thank you so much those video tutorial helped me quite a bit. I was
>> able to create a new directory, as the "introduction to django" tutorial
>> suggested I've made sure its title is project specific. However, I seem to
>> have run into a problem creating a path to my new directory. when last I
>> ran the command I received an Command error stating that my project name
>> was not valid. Any thoughts on what detail I am overlooking would be very
>> appreciated,
>> Thank you
>>
>> On Tue, Mar 12, 2019 at 8:30 AM Suresh Kannan 
>> wrote:
>>
>>> Hi,
>>>
>>> You can watch these videos. I think this might help you.
>>>
>>> https://www.youtube.com/watch?v=FNQxxpM1yOs (windows)
>>>
>>>
>>> https://www.youtube.com/watch?v=oT1A1KKf0SI&list=PLxxA5z-8B2xk4szCgFmgonNcCboyNneMD
>>> (linux)
>>>
>>> On Mon, 11 Mar 2019 at 09:35, Joseph Jones  wrote:
>>>
 Thank you so much, does one bring up the cd command in the python
 terminal?

 On Mon, Mar 11, 2019 at 8:07 AM Kayode Oladipo <
 oladipokayo...@gmail.com> wrote:

> You have to be in the project level directory to access 'manage.py'.
> Use the 'cd' command in the terminal to do this.
>
> On Sun, Mar 10, 2019, 23:23 Joseph Jones 
>> Hello all!
>> I have been reading
>> https://www.packtpub.com/application-development/learn-python-programming-second-edition
>>  Since
>> November, so I am very much new to the Python community. I am currently 
>> on
>> chapter 14 "Web development" which suggests completing the tutorial on
>> djangoproject.com after installing Django of course. When I've run
>> the first two commands in the cmd of my PC I get the output the tutorial
>> would indicate. However when I run the command .../> py manage.py 
>> runserver
>> I receive a command error that no such file exists. My question is what
>> mistake am I making? I'm hypothesizing one is to create a file entitled
>> "manage.py' before beginning, however unless I'm misreading the text in 
>> the
>> tutorial the command .../> django-admin startproject runserver
>> auto-generates said file. Any suggestions on what I'm doing wrong would 
>> be
>> immensely appreciated. Let me apologize in advance if I either, ask for
>> clarification in any responses(again I am new), or mess up again through
>> out the course of the tutorial and again reach out to the community. 
>> Thank
>> you for any help,
>> Joseph
>>
>> --
>> You received this message because you are subscribed 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/CAJGsC5OzcyMwrW%3D-EmU%2B-3o8esQ2JeVQoJScq%3DHy_mtsxKRuKQ%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/CA%2BARzD8BiTZ8Rzfi9twFF7GTzYpBZqpCdpR3K_tGW5b1Rfsdrw%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/CAJGsC5N2poHoALgwHLkk%3D9o9jGeUZ1NStedbnBS-oLdYgVzSQA%40mail.gmail.com
 

Re: Rename column headers with python DictWriter

2019-03-15 Thread Naeem Sunesara
Hey Bijal ,

You can use Python pandas library ..

On Fri, Mar 15, 2019 at 2:22 PM BIJAL MANIAR  wrote:

>
>
> Hi,
>
> Using Python DictWriter can we rename the column names?
>
> Need to rename headers in CSV file so that output looks like. Basically
> need to rename database fieldnames like emp_name, emp_role to
> Name,Designation:
> *Name, Designation*
> ABC, IT
> DEF, Admin
>
> I am using Python DictWriter in django view and below is the snippet:
>
> def export_csv(request):
> data = [
> {'emp_name': 'ABC', 'emp_role': 'IT'},
> {'emp_name': 'DEF', 'emp_role': 'Admin'}
> ]
> response = HttpResponse(content_type='text/csv')
> response['Content-Disposition'] = 'attachment; filename="export.csv"'
>
> *fieldnames = ['emp_name', 'emp_role']*
> writer = csv.DictWriter(response, fieldnames=fieldnames, 
> extrasaction='ignore')
> writer.writeheader()
> for row in data:
> writer.writerow(row)
> return response
>
>
>
> Thanks,
>
> Bijal
>
>
> --
> You received this message because you are subscribed 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/3b805ab5-5214-4258-97e0-e7d2388baf21%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/CAABbT%2BmECoDFH2%3DhaXQeD0FVNy7qR3wnY4GYjXGPi8q2ZqBwnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Looking for a Django co-founder

2019-03-15 Thread akpan aniefiok
Hi There,

I'm interested...

-- 
You received this message because you are subscribed 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/87ec8707-a193-4b2f-a6e9-964dc8a0742a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Looking for a Django co-founder

2019-03-15 Thread abhinav . sagar2016
I am highly interested in working with you on this project.I will be able to 
give 10+ hours on weekends.You can find me at 8754385629

-- 
You received this message because you are subscribed 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/1cbd92f7-b3fd-4264-9562-42ebed7826b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What I am doing wrong

2019-03-15 Thread Chetan Ganji
In the admin.py file that import statement seems to be wrong.  "*from
website.module import website*"
I cant help you more as I dont know the directory structure.

Check for the location of the module named website relative to the admin.py
file.

Regards,
Chetan Ganji
+91-900-483-4183
ganji.che...@gmail.com
http://ryucoder.in


On Fri, Mar 15, 2019 at 5:36 PM Harish Chaudhary 
wrote:

> --
> You received this message because you are subscribed 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/CALxqzK4w7v7pg8XuAX7ZUDhWP-5aejpxMT802AYSfHNi7uRfmA%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/CAMKMUjtTiQJ04gQ-TuOzw0MTFJgGXz5Ag_1jnmvRDNwaEByV4A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: test if model object fits into QuerySet without executing SQL?

2019-03-15 Thread jgibson
Tom,

Could you clarify "fits into"?

qs1 = Table.objects.all()
qs2 = Table.objects.filter(color='blue')


mo1 = qs1[0]


Are you trying to determine if mo1 is in qs2?

Best

On Friday, March 15, 2019 at 7:46:14 AM UTC-4, Thomas Klopf wrote:
>
> Hi all,
>   Please I have a question, couldn't find any answer for it..
>
>   Let's say I have 2 QuerySets:
>   1) Select all records from table
>   2) Select all records from table where color = "blue"
>
> So QuerySet #2 is more restricted than QuerySet #1
>
> So question is - if I get a model object from QuerySet #1, is it possible 
> to check if the model object is 'filtered'  or fits into QuerySet #2, 
> without actually executing the SQL for QuerySet #2 to find the record again?
>
> I'm asking because running the SQL for QuerySet #2 is expensive, ideally 
> would test if the record fits into the QuerySet in purely python/django.
>
> Thanks in advance!
> Tom
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/26c692ef-6e97-4fa2-b5ef-6ebb24e408cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What I am doing wrong

2019-03-15 Thread Harish Chaudhary
Hello Chetan can I send you my project can you please look into it

On Fri, 15 Mar, 2019, 5:53 PM Chetan Ganji,  wrote:

> In the admin.py file that import statement seems to be wrong.  "*from
> website.module import website*"
> I cant help you more as I dont know the directory structure.
>
> Check for the location of the module named website relative to the
> admin.py file.
>
> Regards,
> Chetan Ganji
> +91-900-483-4183
> ganji.che...@gmail.com
> http://ryucoder.in
>
>
> On Fri, Mar 15, 2019 at 5:36 PM Harish Chaudhary 
> wrote:
>
>> --
>> You received this message because you are subscribed 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/CALxqzK4w7v7pg8XuAX7ZUDhWP-5aejpxMT802AYSfHNi7uRfmA%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/CAMKMUjtTiQJ04gQ-TuOzw0MTFJgGXz5Ag_1jnmvRDNwaEByV4A%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/CALxqzK6PkgXvLS%3DMnT4RAYmTqHvuM39cA0LKBSPEj9gT1G38yw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: test if model object fits into QuerySet without executing SQL?

2019-03-15 Thread Phako Perez
You can create query as

def get_query(value=None):
if value:
  query = “select all records from table where color = ‘" + value + “‘
  query = “select all records from table”

return query

Sent from my iPhone

> On Mar 15, 2019, at 6:20 AM, jgib...@caktusgroup.com wrote:
> 
> Tom,
> 
> Could you clarify "fits into"?
> 
> qs1 = Table.objects.all()
> qs2 = Table.objects.filter(color='blue')
> 
> 
> mo1 = qs1[0]
> 
> 
> Are you trying to determine if mo1 is in qs2?
> 
> Best
> 
>> On Friday, March 15, 2019 at 7:46:14 AM UTC-4, Thomas Klopf wrote:
>> Hi all,
>>   Please I have a question, couldn't find any answer for it..
>> 
>>   Let's say I have 2 QuerySets:
>>   1) Select all records from table
>>   2) Select all records from table where color = "blue"
>> 
>> So QuerySet #2 is more restricted than QuerySet #1
>> 
>> So question is - if I get a model object from QuerySet #1, is it possible to 
>> check if the model object is 'filtered'  or fits into QuerySet #2, without 
>> actually executing the SQL for QuerySet #2 to find the record again?
>> 
>> I'm asking because running the SQL for QuerySet #2 is expensive, ideally 
>> would test if the record fits into the QuerySet in purely python/django.
>> 
>> Thanks in advance!
>> Tom
>> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+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/26c692ef-6e97-4fa2-b5ef-6ebb24e408cb%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/2A56D6F6-0AC6-4463-8887-F291E5915A9A%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What I am doing wrong

2019-03-15 Thread Chetan Ganji
Sure. please make sure to mention which class or function from which file
needs to be imported in which file


Regards,
Chetan Ganji
+91-900-483-4183
ganji.che...@gmail.com
http://ryucoder.in


On Fri, Mar 15, 2019 at 6:14 PM Harish Chaudhary 
wrote:

> Hello Chetan can I send you my project can you please look into it
>
> On Fri, 15 Mar, 2019, 5:53 PM Chetan Ganji, 
> wrote:
>
>> In the admin.py file that import statement seems to be wrong.  "*from
>> website.module import website*"
>> I cant help you more as I dont know the directory structure.
>>
>> Check for the location of the module named website relative to the
>> admin.py file.
>>
>> Regards,
>> Chetan Ganji
>> +91-900-483-4183
>> ganji.che...@gmail.com
>> http://ryucoder.in
>>
>>
>> On Fri, Mar 15, 2019 at 5:36 PM Harish Chaudhary 
>> wrote:
>>
>>> --
>>> You received this message because you are subscribed 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/CALxqzK4w7v7pg8XuAX7ZUDhWP-5aejpxMT802AYSfHNi7uRfmA%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/CAMKMUjtTiQJ04gQ-TuOzw0MTFJgGXz5Ag_1jnmvRDNwaEByV4A%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/CALxqzK6PkgXvLS%3DMnT4RAYmTqHvuM39cA0LKBSPEj9gT1G38yw%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/CAMKMUjvH3q4B1UCph5UQJ_oT0Y86%2BiQokYi8cNLm64QDhTO8-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Looking for a Django co-founder

2019-03-15 Thread Ruben Alves
Hi Zack

I see you sent a similar email like a month ago (or at least was another 
user with the same idea)

Back then I didn't reply, but one month later I see you are still talking 
about that, so you seem to be persistent, which I believe is the key for 
success.

I have been working with Django and AWS for some years already, although 
never with React.

I'm available on this WhatsApp number: +353 089 977 3398

Em sexta-feira, 15 de março de 2019 03:40:33 UTC, Zack Amaral escreveu:
>
> Django users,
>
> I'm looking for a Django developer that can commit to working 10 hours a 
> week on the weekend. We work Friday and Saturday at 12AM EST. I'm looking 
> to bring on another developer that's willing to work for equity in my 
> company. We are building a web application similar to twitch.tv. We are 
> using React for the front end and Django for the backend. Everything is on 
> AWS. I can go into more details if you are interested. I can also send you 
> a copy of my business plan.
>
> If you are interested please let me know and I'll set up a call with you 
> to see if it's a good fit.
>
> Thank you for your time,
>
> Zack
>

-- 
You received this message because you are subscribed 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/93ccaef0-db21-4d3d-a67d-5860155ebc15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Looking for a Django co-founder

2019-03-15 Thread RaviKiran Kk
I am interested

On Sat 16 Mar, 2019, 12:24 AM Ruben Alves  Hi Zack
>
> I see you sent a similar email like a month ago (or at least was another
> user with the same idea)
>
> Back then I didn't reply, but one month later I see you are still talking
> about that, so you seem to be persistent, which I believe is the key for
> success.
>
> I have been working with Django and AWS for some years already, although
> never with React.
>
> I'm available on this WhatsApp number: +353 089 977 3398
>
> Em sexta-feira, 15 de março de 2019 03:40:33 UTC, Zack Amaral escreveu:
>>
>> Django users,
>>
>> I'm looking for a Django developer that can commit to working 10 hours a
>> week on the weekend. We work Friday and Saturday at 12AM EST. I'm looking
>> to bring on another developer that's willing to work for equity in my
>> company. We are building a web application similar to twitch.tv. We are
>> using React for the front end and Django for the backend. Everything is on
>> AWS. I can go into more details if you are interested. I can also send you
>> a copy of my business plan.
>>
>> If you are interested please let me know and I'll set up a call with you
>> to see if it's a good fit.
>>
>> Thank you for your time,
>>
>> Zack
>>
> --
> You received this message because you are subscribed 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/93ccaef0-db21-4d3d-a67d-5860155ebc15%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/CAPEfQMRNrh7Hyuqm3Wh4c2uVk6dun07VJfkZF7FtOHgq5%3DBBsg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Thank you for the HINT

2019-03-15 Thread Matthew Pava
I am working on some migration code, and I did not enter the _id suffix to my 
field name in the RunSQL code. Django was very kind to give me the clue to 
reference the column with the _id suffix. That is an amazing hint, and it 
helped significantly. Thank you so 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 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/87227bb02a994325b5f32f90ed4de889%40iss2.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


413 Payload Too Large on Django server

2019-03-15 Thread nate
Hey Django experts!

My team has been getting 413 errors whenever we try and upload large files 
to our Django back-end: 413 Payload too large

We can't exactly pin down the maximum acceptable file size - it seems to 
vacillate in the 1-3MB range.

Things we have excluded:

   - 
   
   It's not a webserver configuration issue, because we're running the
   Django server locally (without a webserver)
   - 
   
   We believe it's not an app server configuration issue, because this 
   happens on multiple app servers (./manage.py runserver and daphne -p 
   8000 topknott.asgi:application)
   - 
   
   It's not an issue with the field on the Django model, which looks 
   normal: photo = models.ImageField(blank=True)
   
Can anyone spot what we're missing?

-- 
You received this message because you are subscribed 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/6cb0dfd7-f4f4-4d9d-b907-f0c792019187%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 413 Payload Too Large on Django server

2019-03-15 Thread Manas Nikam
Check Django settings for maximum file upload size. Change it

On Sat, Mar 16, 2019, 4:20 AM  wrote:

> Hey Django experts!
>
> My team has been getting 413 errors whenever we try and upload large files
> to our Django back-end: 413 Payload too large
>
> We can't exactly pin down the maximum acceptable file size - it seems to
> vacillate in the 1-3MB range.
>
> Things we have excluded:
>
>-
>
>It's not a webserver configuration issue, because we're running the
>Django server locally (without a webserver)
>-
>
>We believe it's not an app server configuration issue, because this
>happens on multiple app servers (./manage.py runserver and daphne -p
>8000 topknott.asgi:application)
>-
>
>It's not an issue with the field on the Django model, which looks
>normal: photo = models.ImageField(blank=True)
>
> Can anyone spot what we're missing?
>
> --
> You received this message because you are subscribed 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/6cb0dfd7-f4f4-4d9d-b907-f0c792019187%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/CAF%2BYYc6N3FvFRmQGbjoM2DUjQuLom0%3DTE6SWEndCYn1av2%2BLPA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


rsync vs git for Django development? + Project directory location?

2019-03-15 Thread drone4four
Have two questions.

To manage development of a Django project, when interfacing local changes 
and mirroring them to my remote webserver, would you people recommend using 
rsync or git? I have a little experience with both. I've been using rsync 
to mirror basic HTML and CSS changes from my local host to my remote Apache 
public_html directory for a while now. I was thinking of using rsync for 
transferring changes to my webserver but in one of the courses I am taking, 
the instructor uses git and GitHub. I’m not sure if using git is overkill 
or not best practices. What would you people recommend?

Whether I go with git or rsync, I also need to make a decision about where 
to place my Django project folder on my VPS. One of the guides I am using, 
titled, “How To Set Up Django with Postgres, Nginx, and Gunicorn on Ubuntu 
18.04 
”
 
suggests putting it inside the user’s home folder. I gather this isn’t the 
most secure option. It’s also not a good idea to place the Django project 
folder inside the Apache public_html folder, am I right? I read both these 
things somewhere a while ago but I can’t recall exactly where. Anyways, to 
set the record straight, where would you people recommend I place my Django 
project folder on my VPS?

-- 
You received this message because you are subscribed 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/994e80b8-0c4d-439c-b0e3-636b8e4f00e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Thank you for the HINT

2019-03-15 Thread Mike Dewhirst

+ 100

Django is marvellous!

:)

On 16/03/2019 9:00 am, Matthew Pava wrote:


I am working on some migration code, and I did not enter the _id 
suffix to my field name in the RunSQL code. Django was very kind to 
give me the clue to reference the column with the _id suffix. That is 
an amazing hint, and it helped significantly. Thank you so 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 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/87227bb02a994325b5f32f90ed4de889%40iss2.ISS.LOCAL 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fe4fb09a-099c-ab94-66a9-470ae8de7b8b%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: 413 Payload Too Large on Django server

2019-03-15 Thread Aldian Fazrihady
Have you tried this setting?
https://docs.djangoproject.com/en/2.1/ref/settings/#data-upload-max-memory-size


Aldian Fazrihady

On Sat, Mar 16, 2019 at 6:53 AM Manas Nikam  wrote:

> Check Django settings for maximum file upload size. Change it
>
> On Sat, Mar 16, 2019, 4:20 AM  wrote:
>
>> Hey Django experts!
>>
>> My team has been getting 413 errors whenever we try and upload large
>> files to our Django back-end: 413 Payload too large
>>
>> We can't exactly pin down the maximum acceptable file size - it seems to
>> vacillate in the 1-3MB range.
>>
>> Things we have excluded:
>>
>>-
>>
>>It's not a webserver configuration issue, because we're running the
>>Django server locally (without a webserver)
>>-
>>
>>We believe it's not an app server configuration issue, because this
>>happens on multiple app servers (./manage.py runserver and daphne -p
>>8000 topknott.asgi:application)
>>-
>>
>>It's not an issue with the field on the Django model, which looks
>>normal: photo = models.ImageField(blank=True)
>>
>> Can anyone spot what we're missing?
>>
>> --
>> You received this message because you are subscribed 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/6cb0dfd7-f4f4-4d9d-b907-f0c792019187%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/CAF%2BYYc6N3FvFRmQGbjoM2DUjQuLom0%3DTE6SWEndCYn1av2%2BLPA%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/CAN7EoAa8zYzEh7Z8d8fa2%3D7Ynzr1XQZhX10kBr%3DHb2bjpjcWdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Separating remote vs local settings.py parameters - - “EMAIL”?

2019-03-15 Thread drone4four


If you take a look at this gist provided by a Udemy instructor and at this 
specific location 
,
 
here he wisely recommends separating important local development 
configuration parameters, such as SECRET _KEY. Of course everyone knows how 
stupid and foolish it would be to share the SECRET_KEY publicly on GitHub 
and then to use it in your production environment. 


So here is the list of parameters to place in the separate remote 
settings.py as it appears in that gist linked to above:


   - 
   
   SECRET_KEY
   - 
   
   ALLOWED_HOSTS
   - 
   
   DATABASES
   - 
   
   DEBUG
   - 
   
   EMAIL_*
   

If you look at the last one, it says: “EMAIL_*”. What do you people think 
the “_*” suffix? Is this standard for settings.py configurations? Or would 
you people think this is just a glaring typo on the side of the instructor?

-- 
You received this message because you are subscribed 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/fa499e85-b7cd-43a1-b21a-e8d6c665e498%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Separating remote vs local settings.py parameters - - “EMAIL”?

2019-03-15 Thread Ahmed Ishtiaque
The character "*" represents "wildcard". Here is the real reason why the
instructor puts it that way:
https://docs.djangoproject.com/en/2.1/ref/settings/#email-backend

There are a lot of variables that contain the 'EMAIL_' prefix, which is why
the instructor wrote it that way.

On Fri, Mar 15, 2019 at 8:16 PM drone4four  wrote:

> If you take a look at this gist provided by a Udemy instructor and at
> this specific location
> ,
> here he wisely recommends separating important local development
> configuration parameters, such as SECRET _KEY. Of course everyone knows how
> stupid and foolish it would be to share the SECRET_KEY publicly on GitHub
> and then to use it in your production environment.
>
>
> So here is the list of parameters to place in the separate remote
> settings.py as it appears in that gist linked to above:
>
>
>-
>
>SECRET_KEY
>-
>
>ALLOWED_HOSTS
>-
>
>DATABASES
>-
>
>DEBUG
>-
>
>EMAIL_*
>
>
> If you look at the last one, it says: “EMAIL_*”. What do you people think
> the “_*” suffix? Is this standard for settings.py configurations? Or would
> you people think this is just a glaring typo on the side of the instructor?
>
> --
> You received this message because you are subscribed 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/fa499e85-b7cd-43a1-b21a-e8d6c665e498%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/CAKizqR7JGGJyD9c7AXG%3Dun%2BL7dNsknE2XF_xC2r%3D0x2%2BRmzueg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: rsync vs git for Django development? + Project directory location?

2019-03-15 Thread Bill Freeman
I'm sure that you'll get many opinions, but:

I've had success with git, presuming that filesystem space is not very
tight on the remote server.  You arrange your deployment scripts to run on
the remote (there are several tools to help with that, or for small scale
operations, ssh in and run them directly.  These scripts do a pull from
your central git repository (if you've got that on something other than
your development box, such as github, then your code and version history
are now redundantly in 3 places, at least), and then check out the revision
that has passed continuous integration (you will want to eventually) and
code review (buddy up with someone in the same boat if need be - I don't
care how good you are, a second set of eyes is a treasure).  And if it
bombs, or a problem shows up, rollback to the previous version is just
another checkout, your typed commands being the only things that must cross
the network.  If you had migrations with the new version, you may have to
run reverse migrations (a DB backup on the remote or DB server just before
installing a update is a good idea).

As to the security of the user account on the server box, that depends on
whether the user does anything else, and how automagically someone cracking
your development box can leverage that into access on the server.  Worse
that having stuff in a random user account also used for other things is
having this stuff under root.  It means that you have to get into root way
too often, and also a bug that tries to blow things away has the root
access to do it.  I've often deployed with apache, and made the /www
directory belong to apache.  Nothing there is served by apache except by
being explicitly listed in the apache configuration, such as directories
for CSS and js that are populated by running django's collectstatic
management command, which your scripts should run, among other things,
after checkout of a different revision..  The project directory and
probably a venv directory are there for convenience, but can't be served by
apache.  I presume that Nginx is similarly competent.  It was used at a few
places I worked, but I didn't have to deploy it, so I've not learned the
details.

Bill

On Fri, Mar 15, 2019 at 7:42 PM drone4four  wrote:

> Have two questions.
>
> To manage development of a Django project, when interfacing local changes
> and mirroring them to my remote webserver, would you people recommend using
> rsync or git? I have a little experience with both. I've been using rsync
> to mirror basic HTML and CSS changes from my local host to my remote Apache
> public_html directory for a while now. I was thinking of using rsync for
> transferring changes to my webserver but in one of the courses I am taking,
> the instructor uses git and GitHub. I’m not sure if using git is overkill
> or not best practices. What would you people recommend?
>
> Whether I go with git or rsync, I also need to make a decision about where
> to place my Django project folder on my VPS. One of the guides I am using,
> titled, “How To Set Up Django with Postgres, Nginx, and Gunicorn on
> Ubuntu 18.04
> ”
> suggests putting it inside the user’s home folder. I gather this isn’t the
> most secure option. It’s also not a good idea to place the Django project
> folder inside the Apache public_html folder, am I right? I read both these
> things somewhere a while ago but I can’t recall exactly where. Anyways, to
> set the record straight, where would you people recommend I place my Django
> project folder on my VPS?
>
> --
> You received this message because you are subscribed 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/994e80b8-0c4d-439c-b0e3-636b8e4f00e2%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/CAB%2BAj0u-j_ry4sK9O5Ab17OBzLb6_bJD24XeNwR6WdVnXEKnrg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.