Where do you place your application code in production

2019-01-14 Thread vineeth sagar
Hi,

This is not concerned with django itself, but I would love to get the
general consensus here, In my college days while deploying a php
application all the tutorials pointed to place my code in /var/www or
something of that sort. For my django applications I tend to put it in
/home//services/. What are the potential drawbacks of placing it
inside home? Where do you generally place you application code?



regards
Vineeth

-- 
You received this message because you are subscribed 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/CAMMZq8NuE_M0nrU0Hxt7oeFuTVOZNJbgDL%2BAL5vM%3D9SL6T2uJg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Local variable dump on exception in production environment (DEBUG=False)

2019-02-01 Thread vineeth sagar
Hi,

I am not sure about django, but you can have a look at sentry, we use it in
production and it gives everything you ask for. I am sure Django also does
it but I find sentry better for error reporting.

regards
Vineeth

On Feb 1, 2019 3:41 PM, "Web Architect"  wrote:

> Hi,
>
> In our production environment, we receive mail whenever an exception
> happens in our django application. But it contains only the function
> traces. The log will be helpful it also contains data dump or the local
> variable dump for each function trace.
> The exception trace on the browser in our development environment
> (DEBUG=True) contains the local variable dump.
>
> Hence, could anyone let me know if it's possible to get the local variable
> dump during exceptions in our django application?
>
> 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/5b32c8ae-eb93-425d-88dc-d2c2a775a487%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/CAMMZq8OdmiWYKAHaV3W_CCzQWP6x0gGuOTK7khrWacA6jPha8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Local variable dump on exception in production environment (DEBUG=False)

2019-02-01 Thread vineeth sagar
Ha, Hope you find a solution with django itself, sentry integration is just
two lines and boom all uncaught exceptions, logger.error,exception,critical
are automatically reported. Goodluck

regards
Vineeth

On Fri, Feb 1, 2019 at 4:45 PM Web Architect  wrote:

> Hi Vineeth,
>
> Thanks for the info. Sentry sounds interesting and we will have a look at
> Sentry as it might need integration.
>
> Django does report function trace via mails but we are looking for the
> local variable trace also . Was hoping a small tweak in django should help.
>
> Thanks.
>
> On Friday, February 1, 2019 at 4:00:13 PM UTC+5:30, vineeth sagar wrote:
>>
>> Hi,
>>
>> I am not sure about django, but you can have a look at sentry, we use it
>> in production and it gives everything you ask for. I am sure Django also
>> does it but I find sentry better for error reporting.
>>
>> regards
>> Vineeth
>>
>> On Feb 1, 2019 3:41 PM, "Web Architect"  wrote:
>>
>>> Hi,
>>>
>>> In our production environment, we receive mail whenever an exception
>>> happens in our django application. But it contains only the function
>>> traces. The log will be helpful it also contains data dump or the local
>>> variable dump for each function trace.
>>> The exception trace on the browser in our development environment
>>> (DEBUG=True) contains the local variable dump.
>>>
>>> Hence, could anyone let me know if it's possible to get the local
>>> variable dump during exceptions in our django application?
>>>
>>> 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 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/5b32c8ae-eb93-425d-88dc-d2c2a775a487%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/5b32c8ae-eb93-425d-88dc-d2c2a775a487%40googlegroups.com?utm_medium=email&utm_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/c6a39e60-5385-41df-a444-ab4fa5c4f614%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c6a39e60-5385-41df-a444-ab4fa5c4f614%40googlegroups.com?utm_medium=email&utm_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/CAMMZq8Nr_6HGDO0Ae0_BiXFw0o%2BHA4dh-qvDA_3yr350o%3Dv_6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How can I make users login to my site with facebook/twitter/google?

2019-03-05 Thread vineeth sagar
You can use django social auth.

https://python-social-auth-docs.readthedocs.io/en/latest/configuration/django.html

If you just want to learn. Look up Oauth2 and then use developer
documentation to implement login with django.



On Tue, 5 Mar, 2019, 22:49 Sandip Nath,  wrote:

> i want users to my site to log log in with facebook, twitter, google.
> While the development server supports only http fb/twitter/google expects
> https. What to do?
>
> --
> You received this message because you are subscribed 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/53f8baf2-04d4-4be9-9ce0-e9a98d5d9657%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/CAMMZq8OopomttBcwyWYjL%2Box6CnLACT-fHqa1ETeZxo5iWt3EA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How this Line of code works

2019-04-14 Thread vineeth sagar
Hi Mayur,

get_object_or_404, returns an object if it exists in the database or it
will raise a 404 exception. So if the object is in the DB, django render
template is done, in your case detail.html is rendered with the context
dictionary.If there's no row peertaining to the query, then Http404  is
raised. So django exception handling kicks in and based on the error code
and your debug parameter a particular template is selected.

regards
Vineeth

On Sun, 14 Apr 2019, 13:16 Mayur Bagul,  wrote:

> In below code i didnt understand how colored line of code is working with
> template code ?
>
> why we are passing Question and primary key? instead of dictionary to
> context variable.
>
> plz help me to get out of this confusion.
>
> thanking you.
>
>
>  *view.py*
>
>
> from django.shortcuts import get_object_or_404, render
>
> from .models import Question
> # ...
> def detail(request, question_id):
> question = get_object_or_404(Question, pk=question_id)
> return render(request, 'polls/detail.html', {'question': question})
>
>
>
>  *detail.html*
>
>
> {{ question.question_text }}
> 
> {% for choice in question.choice_set.all %}
> {{ choice.choice_text }}
> {% endfor %}
> 
>
>
>
>
> --
> You received this message because you are subscribed 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/73130e11-1eaf-4f03-8b56-3d6d4be6fd50%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/CAMMZq8PCxZC2ydA-ja%2BR34yhXcONbBv%2BvFgQ3DEyXJj5dqHAXw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django - always getting False in form.is_valid()

2019-04-19 Thread vineeth sagar
can you please post, request.POST output?

On Fri, 19 Apr 2019, 16:34 Sipum Mishra,  wrote:

> Hi All,
>
> I am always getting - form.is_valid returning False. kindly check where I
> am doing wrong.
> please find below code.
>
>
> views.py
> ---
> def home(request):
>
> if request.method == 'POST':
> form = ListForm(request.POST or None)
> print(form.is_valid(), "-->",request.POST['Item'])
> print(form.errors)
> print(form)
> if form.is_valid():
> form.save()
> all_items = List.objects.all
> messages.success(request, ('Item has been Added to the List!'))
> return render(request,'home.html', {'all_items' : all_items})
> else:
> print("deba-->",request.POST)
> return HttpResponse("Form is invalid!")
> else:
> all_items = List.objects.all
> return render(request,'home.html', {'all_items' : all_items})
>
> -
> form.py
> -
>
> class ListForm(forms.ModelForm):
> class Meta:
> model = List
> fields = ["item", "completed"]
>
>
> 
> model.py
> -
>
> class List(models.Model):
> item = models.CharField(max_length=200)
> completed = models.BooleanField(default=False)
>
>
> def __str__(self):
> return self.item + '|' + str(self.completed)
>
> --
> You received this message because you are subscribed 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/4ca5e82d-f34b-4ab4-8f82-5be0dcdebecc%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/CAMMZq8OxVOJ8cF%3DFTNriHjBXKvdv29in-gOB-M-ia86L_ntSQw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: DateTimeField is in UTC but need IST standards

2019-04-30 Thread vineeth sagar
whenever USE_TZ=True is enabled, the timestamp is stored as a UTC object.
This is standard practice, why?

https://docs.djangoproject.com/en/2.2/topics/i18n/timezones/

Go through this, more than once. It'll be helpful.

On Tue, 30 Apr 2019, 18:09 Sampath Reddy, 
wrote:

> Hey guys,
>
> I am using DjangoRestFramework as tech stack to develop backend API points
> for my application.
>
> I have a model with field created = models.DateTimeField(auto_now_add=True)
> in one of the models.
>
> I am using mysql as backend db, now the problem I am having is I am not
> able to figure out how the timestamp is being generated. timestamp is in
> UTC.
>
> But I want to store IST standards i.e TimeZone 'Asia/Kolkata'
>
> I can confirm mysql database time settings and Django TimeZone settings
> are working as expected i.e IST standards.
>
> Kindly someone please help me in figuring how the timestamp is being
> generated wen I am posting data to the table.
>
> Thanks and Regards,
> Sampath
>
>
> --
> You received this message because you are subscribed 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/CAErixQ1YWANdnf21jOf0yxMcFRX0S1RExs4-%3DOMEY5v6pLNmsw%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/CAMMZq8M7JYBuimPbkvH_ot_yB%3DUw4Gj1w%3DRZXyWFfw3GuYPNMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to modify LOGGING settings in unittest

2019-06-10 Thread vineeth sagar
Try this with the override_settings decorator. like this.

@override_settings(LOGGING_DIR='/tmp/test_logs/'
def test_function1(self):
pass

On Mon, Jun 10, 2019 at 7:15 PM panfei  wrote:

> There is a logger path for production environment, but I want to put the
> logs in /tmp/ in unittests.
>
> This is the LOGGING settings for production environment:
>
> LOGGING_DIR = '/data0/bridge_logs_test/'
> LOGGING = {
> 'version': 1,
> 'disable_existing_loggers': False,
> 'formatters': {
> 'default': {
> 'format': 
> '{levelname}\t{asctime}\t{pathname}\t{lineno:d}\t{process:d}\t{message}',
> 'style': '{'
> }
> },
>
> 'handlers': {
> 'console_log_handler': {
> 'level': 'ERROR',
> 'class': 'logging.StreamHandler',
> },
>
> 'backup_log_handler': {
> 'level': 'INFO',
> 'class': 'logging.handlers.WatchedFileHandler',
> 'filename': os.path.join(LOGGING_DIR, 'put.log'),
> 'formatter': 'default',
> },
>
> ..
> },
>
> 'loggers': {
> 'django': {
> 'handlers': ['console_log_handler', ],
> 'level': 'DEBUG',
> 'propagate': True,
> },
>
> 'backup': {
> 'handlers': ['backup_log_handler', ],
> 'level': 'INFO',
> 'propagate': False,
> },
>
> ..
> },
> }
>
> And in unittests, I write:
>
> from django.test import TestCase
> class FaceAITestCase(TestCase):
> def test_function1(self):
> with self.modify_settings(LOGGING_DIR="/tmp/test_logs/"):
> pass
>
>
> When run the unittests, it reports:
> ValueError: Unable to configure handler 'access_log_handler': [Errno 2] No 
> such file or directory: '/data0/bridge_logs_test/access.log'
>
> And how to use /tmp/test_logs/ as the log directory in unittests ? any
> ideas ? 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/CA%2BJstLD7nDPz_%2BCs203Eh2Qzk-A1wawOzbtA%3DpFE7Lb0FZBaeQ%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/CAMMZq8NDG_WFJXofeBub7oMysWKFDWo%3DUUC23r0NdM0DC3UV1w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Urgent] 500 when requesting a file from browser.

2019-06-20 Thread vineeth sagar
I need to display images on canvas, so I have used the following snippet.
The request is reaching the server but I get the following trace. Unable to
make sense out of it, if any of you can help out, it would be great.

function getImage(file_name, num_pages) {
myimage = new Image();
myimage.onload = function () {
//console.log();
alert("Vineeth");
canvas.width = myimage.width;
canvas.height = myimage.height;
ctx.drawImage(myimage, 0, 0);
}
myimage.src = window.origin + "{% static '' %}" + file_name +
"-" + '1.ppm';
//"
https://cdn.images.express.co.uk/img/dynamic/67/590x/secondary/Frank-Lampard-Chelsea-Derby-1922384.jpg?r=1560987023999
";
//window.origin + "{%static ''%}" + file_name + "-" + '1.ppm';
console.log(myimage.src);
}

Folks, please have a look at this.

Error Traceback;

Traceback (most recent call last):
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 138, in run
self.finish_response()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 180, in
finish_response
self.write(data)
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 279, in write
self._write(data)
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 453, in _write
result = self.stdout.write(data)
  File "/usr/lib/python3.6/socketserver.py", line 800, in write
self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer
[20/Jun/2019 09:10:11] "GET
/static/f7cae2dc-ac60-4ec4-b562-4a4dafb3946d-1.ppm HTTP/1.1" 500 59

Exception happened during processing of request from ('127.0.0.1', 41614)
[20/Jun/2019 09:10:11] "GET /favicon.ico HTTP/1.1" 200 45
Traceback (most recent call last):
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 138, in run
self.finish_response()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 180, in
finish_response
self.write(data)
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 279, in write
self._write(data)
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 453, in _write
result = self.stdout.write(data)
  File "/usr/lib/python3.6/socketserver.py", line 800, in write
self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 141, in run
self.handle_error()
  File
"/home/madeye/Desktop/WorkSpace/Annotate_Arch/lib/python3.6/site-packages/django/core/servers/basehttp.py",
line 116, in handle_error
super().handle_error()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 368, in handle_error
self.finish_response()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 180, in
finish_response
self.write(data)
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 274, in write
self.send_headers()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 344, in
client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/socketserver.py", line 651, in
process_request_thread
self.finish_request(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.6/socketserver.py", line 721, in __init__
self.handle()
  File
"/home/madeye/Desktop/WorkSpace/Annotate_Arch/lib/python3.6/site-packages/django/core/servers/basehttp.py",
line 171, in handle
self.handle_one_request()
  File
"/home/madeye/Desktop/WorkSpace/Annotate_Arch/lib/python3.6/site-packages/django/core/servers/basehttp.py",
line 194, in handle_one_request
handler.run(self.server.get_app())
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 144, in run
self.close()
  File
"/home/madeye/Desktop/WorkSpace/Annotate_Arch/lib/python3.6/site-packages/django/core/servers/basehttp.py",
line 111, in close
super().close()
  File "/usr/lib/python3.6/wsgiref/simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'


-- 
You received this message because you are subscribed 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 w

A few doubts with an implementation.

2018-07-02 Thread Vineeth Sagar
Problem:
We are developing a email-CRM. The task at hand is to fetch emails every N 
minutes or hours. I have received a codebase written by another guy who 
left the company,my job is to re-write/re-factor. The guy who previously 
wrote the code started a thread whenever a user logged and he put a 
time.sleep() inside it, There's no limit on number of threads that can be 
initialized, if 100 users log in, we will have 100 active threads, he used 
locks so that at any given time only one thread can be executed. 

Solution:
It's messy in so many ways(mentioned above) and I think writing django 
middleware would be appropriate for this task. So here's what I plan to do, 
using a Django cache I store a Python datetime object and a flag to see if 
there is any other request that's already retrieving the mails, I don't 
want multiple requests to retrieving mails at once. Is this a better idea? 
Are there any other ways to do this particular task?

One more doubt I have is I want the user to know that the mails are being 
retrieved so he doesn't refresh the page passive-aggressively. How can I do 
this? I want the user to know it's happening and in the background 
middleware should be executed, I have to keep retrieving mails and once 
it's completed I'll execute the view_func parameter received via the 
process_request hook. 

I am a junior at the company(Start up),I am fairly new to django, I keep 
reading the documentation and find new things daily,after picking my mind 
for a day this to me seems best, but please if you have any suggestion let 
me know. Please help me out. 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/c563187e-a3ee-49c0-8c56-cb924a128891%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A few doubts with an implementation.

2018-07-02 Thread Vineeth Sagar
Mikhailo Keda wrote:
>
> to fetch emails every N minutes or hours  - 
> http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html
> I want the user to know that the mails are being retrieved - 
> https://channels.readthedocs.io/en/latest/
>

Thanks Mikhailo for the prompt reply, I'll spend a few days reading the 
documentation of the libraries you have pointed me to. Are web sockets 
supported in IE, iirc I don't think they do. Half of our clients Will use 
IE, not edge, good old fucked up IE. Also I was expecting a critique on my 
ideas. I want to weigh the pro's and con's of my approach vs clerey's(It 
might be clear once I read the docs.)

again 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/10ea3eba-a72f-4d33-8504-4658c0b810ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Some Doubts on Session Expiries

2018-07-25 Thread vineeth sagar
Hi,

I have been going crazy for the past few days trying to understand 
sessions, my settings.py file as the following,

SESSION_SAVE_EVERY_REQUEST=True
SESSION_COOKIE_AGE=2*60 

Now whenever a request is initiated shoudn't the expiry date of the cookie 
i.e the one that holds the session id ,doubled i.e become four minutes. 
This is not happening and I am using chrome. Is this normal? I don't think 
so,from the amount of stackoverflow posts on this discussion.

Now towards the second part of the question, Forget about what I have said 
till now, now my settings.py contains only this.

SESSION_EXPIRE_AT_BROWSER_CLOSE=True.

A user "admin" has initiated a request, done some work closed his browser, 
session cookie holding the session id has expired and that's wonderful as 
expected. 

Now If I run this snippet,

from django.contrib.sessions.models import Session
from django.utils import timzone

sessions = Sessions.objects.filter(expire_date__gte=timezone.now())

The above queryset has the session of the admin user, I am confused is this 
expected behavior? Can someone please address the queries for me.

Thank you

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 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/464b49f3-9a01-41e1-a187-674c7bdcb380%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Problems Faced with some login requirements. Please read the thread below

2018-08-01 Thread vineeth sagar
Hi,

So we are currently doing a project where the client wants the session to 
expire at browser close and also prevent multiple logins from the same 
account. Well there are some ways to implement the multiple login thing, 
consider this say user closes the browser, the session cookie expires. When 
a new request comes in we cannot validate this to see if this is a new 
login request because of expiry or if this a second login from the same 
account. So there's no good way to implement this(I think).

I suggested this, have a rigid session expiry that is it expires in 'N' 
hours/minutes/seconds, So when a new request comes in we can validate with 
the session expiry in the db. If the session has not expired we know that 
he's trying to login for a second time. 
. I needed to change the session middleware to set the outgoing cookie only 
once. I only modified process_response, I pasted it below. I also added a 
new seessionstore class override two methods. The logic is simple, for the 
first time when a new request comes in, load is never invoked. So in 
create_db_instance we set an expiry date. When ever people try to modify 
the session, the load is invoked and we can get the expiry of the exisiting 
session from  that.


*It's works fine without any side affects. From what I understand after 
reading through session modules for a 3 straight days, I am just posting it 
here so that I know if I have not done some thing stupid, I want to have a 
second set of eyes to validate my approach.*



class NewSessionStore(SessionStore):
actual_expiry=None
def _get_session_from_db(self):
try:
return self.model.objects.get(
session_key=self.session_key,
expire_date__gt=timezone.now()
)
except (self.model.DoesNotExist, SuspiciousOperation) as e:
if isinstance(e, SuspiciousOperation):
logger = logging.getLogger(
'django.security.%s' % e.__class__.__name__)
logger.warning(str(e))
self._session_key = None
def load(self):
#print("In load")
s = self._get_session_from_db()
if s:
self.actual_expiry=s.expire_date
return self.decode(s.session_data) if s else {}
def create_model_instance(self, data):
"""
Return a new instance of the session model object, which represents the
current session state. Intended to be used for saving the session data
to the database. 
"""
#print("In create_model_instance")
if not self.actual_expiry:
from datetime import datetime
print("Expire Time thats being set",datetime.now())
self.actual_expiry=self.get_expiry_date()
return self.model(
session_key=self._get_or_create_session_key(),
session_data=self.encode(data),
expire_date=self.actual_expiry,
)


def process_response(self, request, response):
"""
If request.session was modified, or if the configuration is to save the
session every time, save the changes and set a session cookie or delete
the session cookie if the session has been emptied.
"""
try:
accessed = request.session.accessed
modified = request.session.modified
empty = request.session.is_empty()
except AttributeError:
pass
else:
# First check if we need to delete this cookie.
# The session should be deleted only if the session is entirely empty
if settings.SESSION_COOKIE_NAME in request.COOKIES and empty:
response.delete_cookie(
settings.SESSION_COOKIE_NAME,
path=settings.SESSION_COOKIE_PATH,
domain=settings.SESSION_COOKIE_DOMAIN,
)
else:
if accessed:
patch_vary_headers(response, ('Cookie',))
if (modified or settings.SESSION_SAVE_EVERY_REQUEST) and not empty:
if request.session.get_expire_at_browser_close():
max_age = None
expires = None
else:
max_age = request.session.get_expiry_age()
if request.COOKIES.get(settings.SESSION_COOKIE_NAME):
pass
else:
expires_time = time.time()+max_age
expires = http_date(expires_time)
response.set_cookie(
settings.SESSION_COOKIE_NAME,
request.session.session_key, max_age=max_age,
expires=expires,
domain=settings.SESSION_COOKIE_DOMAIN,
path=settings.SESSION_COOKIE_PATH,
secure=settings.SESSION_COOKIE_SECURE or None,
httponly=settings.SESSION_COOKIE_HTTPONLY or None,
)
# Save the session data and refresh the client cookie.
# Skip session save for 500 responses, refs #3881.
if response.status_code != 500:
try:
request.session.save()
except UpdateError:
raise SuspiciousOperation(
"The request's session was deleted before the "
"request completed. The user may have logged "
"out in a concurrent request, for example."
)

-- 
You received this message because you are subscribed 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/b754ba38-f4bf-4f5f-8db6-e5eb1b0759da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: JSON serializable error

2018-08-03 Thread vineeth sagar
You can use unix timestamp, It's json serializable and can be converted to
a datetime object. If I am not wrong you were trying to store it in a
session? try this.

import time

timestamp=time.time()
request.session['current time']= timestamp
import datetime

datetime.datetime.fromtimestamp(request.session['current time'])

On Fri, Aug 3, 2018 at 7:56 PM, Julio Biason  wrote:

> Hi Anusha,
>
> It seems you're trying to generate a JSON of some object/dictionary with a
> Datetime in it. Datetimes are not serializable 'cause there is no date/time
> representation in JSON (maybe epoch, but that's not the default).
>
> On Fri, Aug 3, 2018 at 11:18 AM, Anusha Kommineni <
> anushakommineni...@gmail.com> wrote:
>
>> Hi,
>> I am getting below error.Can anyone help me?
>>
>>
>> TypeError: datetime.datetime(2018, 2, 12, 0, 0, tzinfo=) is not JSON
>> serializable
>>
>> --
>> You received this message because you are subscribed 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/CACBpiKjjH6WhtHfc%3DqLzQ7v5Dc7jDNuAmkRnzB4k
>> b9rzE_Rr1Q%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> *Julio Biason*, Sofware Engineer
> *AZION*  |  Deliver. Accelerate. Protect.
> Office: +55 51 3083 8101   |  Mobile: +55 51
> *99907 0554*
>
> --
> You received this message because you are subscribed 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/CAEM7gE0KV4kLbOnb2Eeinohpa%3D_
> F3MmF7cuo%2BH0N_gYKxG_78g%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/CAMMZq8PcK1Eh7%2B_jR%3DtOnXP4gYSTU%3D4Bz4XUs8K9cizbrYGpBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Learning django

2018-08-05 Thread vineeth sagar
Not to be mean or cheeky, but Django documentation is best book imo. Read
the docs, if they are unclear in anyway, Start reading code. That's how I
learnt about sessions and also you'll get to learn all kinds of cool stuff
when you start reading Django code, Like property,cached property, Lazy
evaluation etc.

On Aug 5, 2018 10:29 PM, "Caleb Bryson"  wrote:

> Are there any books that teach django for the most recent version out
> there? I have not been successful at finding a book with up to date info
>
> --
> You received this message because you are subscribed 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/0ef86713-ab00-4ae5-8bc5-9c448b9afa13%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/CAMMZq8PB2GUgc4h%3DKAQt4Y8n6v9LY9Cp1dmqK-2RNpkHJkwa2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Making a django project and an API.

2018-08-22 Thread vineeth sagar
Hi I am pretty comfortable django. Now recently started working on a fresh 
project, they want a normal project and an browsable api. I have seen the 
drf and it's great, the browsable api in drf documentation is what they(my 
boss) wants. How do I start developing both of them simultaneously. I will 
have all the models written in the normal django applications, all I have 
to do is make model serializers for the api, that's straight forward, The 
views of our django project that return json data can be made as a drf 
views and can be made callable without re-writing much of the logic. How 
ever the doubt I have is, how should I handle views that render webpages? 
Should I re-write the whole functions again to return json data, or Is 
there something available in the drf that will help with this? I am new to 
making api's. I know for a fact an api returns json data. How can I handle 
this particular case please help me. If any parts of the questions 
confusing you please ask me I will give you the clarification. If my 
concept has a flaw(Which I think there is) please correct me.


Thanks
vineeth

-- 
You received this message because you are subscribed 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/637196ee-178a-40f2-b2a8-1fee569802db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Making a django project and an API.

2018-08-22 Thread vineeth sagar
Hey Mike I like reading books rather than tutorials please share the name
of the book.

On Aug 23, 2018 5:47 AM, "Mike Dewhirst"  wrote:

> If you can get your hands on a copy of Two Scoops of Django 1.11, there is
> a whole chapter on DRF. I've just had a look through it (20+ pages) and I
> reckon it will answer all your questions.
>
> On 23/08/2018 5:10 AM, vineeth sagar wrote:
>
>> Hi I am pretty comfortable django. Now recently started working on a
>> fresh project, they want a normal project and an browsable api. I have seen
>> the drf and it's great, the browsable api in drf documentation is what
>> they(my boss) wants. How do I start developing both of them simultaneously.
>> I will have all the models written in the normal django applications, all I
>> have to do is make model serializers for the api, that's straight forward,
>> The views of our django project that return json data can be made as a drf
>> views and can be made callable without re-writing much of the logic. How
>> ever the doubt I have is, how should I handle views that render webpages?
>> Should I re-write the whole functions again to return json data, or Is
>> there something available in the drf that will help with this? I am new to
>> making api's. I know for a fact an api returns json data. How can I handle
>> this particular case please help me. If any parts of the questions
>> confusing you please ask me I will give you the clarification. If my
>> concept has a flaw(Which I think there is) please correct me.
>>
>>
>> Thanks
>> vineeth
>> --
>> You received this message because you are subscribed 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 > django-users+unsubscr...@googlegroups.com>.
>> To post to this group, send email to django-users@googlegroups.com
>> <mailto: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/637196ee-178a-40f2-b2a8-1fee569802db%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/637196ee-178
>> a-40f2-b2a8-1fee569802db%40googlegroups.com?utm_medium=email
>> &utm_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/1aaaf770-14a4-0b56-1e5d-42815b62639c%40dewhirst.com.au.
> 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/CAMMZq8Mp6ewPs7MC%3Dig4bGtmWWCzwCdJjd3RbOhZKns4_dqpnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Making a django project and an API.

2018-08-22 Thread vineeth sagar
Sorry, got the name of the book.

On Aug 23, 2018 9:29 AM, "vineeth sagar"  wrote:

> Hey Mike I like reading books rather than tutorials please share the name
> of the book.
>
> On Aug 23, 2018 5:47 AM, "Mike Dewhirst"  wrote:
>
>> If you can get your hands on a copy of Two Scoops of Django 1.11, there
>> is a whole chapter on DRF. I've just had a look through it (20+ pages) and
>> I reckon it will answer all your questions.
>>
>> On 23/08/2018 5:10 AM, vineeth sagar wrote:
>>
>>> Hi I am pretty comfortable django. Now recently started working on a
>>> fresh project, they want a normal project and an browsable api. I have seen
>>> the drf and it's great, the browsable api in drf documentation is what
>>> they(my boss) wants. How do I start developing both of them simultaneously.
>>> I will have all the models written in the normal django applications, all I
>>> have to do is make model serializers for the api, that's straight forward,
>>> The views of our django project that return json data can be made as a drf
>>> views and can be made callable without re-writing much of the logic. How
>>> ever the doubt I have is, how should I handle views that render webpages?
>>> Should I re-write the whole functions again to return json data, or Is
>>> there something available in the drf that will help with this? I am new to
>>> making api's. I know for a fact an api returns json data. How can I handle
>>> this particular case please help me. If any parts of the questions
>>> confusing you please ask me I will give you the clarification. If my
>>> concept has a flaw(Which I think there is) please correct me.
>>>
>>>
>>> Thanks
>>> vineeth
>>> --
>>> You received this message because you are subscribed 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 >> django-users+unsubscr...@googlegroups.com>.
>>> To post to this group, send email to django-users@googlegroups.com
>>> <mailto: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/637196ee-178a-40f2-b2a8-1fee569802db%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/637196ee-178
>>> a-40f2-b2a8-1fee569802db%40googlegroups.com?utm_medium=email
>>> &utm_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/1aaaf770-14a4-0b56-1e5d-42815b62639c%40dewhirst.com.au.
>> 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/CAMMZq8Prm9c_JWnT5pXCU4sZmDnBdQjOhYP0%3DDdrQ1Rt4jggVw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Doubts on One-To-One Field

2018-08-30 Thread vineeth sagar
def userProfile(models.Model):
  user=models.OneToOneField(User,primary_key=True)
   """
   Other stuff
   """
I can query it like this 
x = userProfile.objects.get(user__id=1)(Assuming this exists)

when I do a connection.queries a single query is executed.When I try to 
access the username i.e x.user.username a new query is executed again when 
I see connection.queries? Is this the expected behavior. Wouldn't this be 
bad if we have huge databases? I have a scenario where some classes have 
common information and then they have different fields based on their 
classes. I have tested this OneToOneField by the above example and for some 
reason reluctant to use this because of the new query? The other approach 
would be abstract base classes where information stored in the db would be 
duplicated but the additional query can be saved I think any thoughts?

-- 
You received this message because you are subscribed 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/afb76a5c-30c7-45f0-8f8a-96e1d30e731c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Doubts on One-To-One Field

2018-08-30 Thread vineeth sagar
Actually we would be needing that information most of the time, I will have
to see the which would be favourable and also of course django  has
documented  a doubt I have. I guess I have to rtfd more carefully. Thank
you for the information. You are a savior.



On Thu, Aug 30, 2018 at 10:54 PM Michael MacIntosh <
mmacint...@linear-systems.com> wrote:

> Hello,
>
> You are correct, creating a one-to-one relationship can potentially create
> more queries and hurt performance if you are not careful.  However it can
> also speed up certain queries if you don't need that information all of the
> time.
>
> If you are worried about the performance, I would suggest looking into
> select_related and prefetch_related.  Select related will grab your Users
> and user profiles in one query, which can be faster.  Prefetch related will
> fire off a query for each prefetched item, so one for users and one for
> user profiles, which isn't useful here.
>
> https://docs.djangoproject.com/en/2.1/ref/models/querysets/#select-related
>
> On 8/30/2018 9:08 AM, vineeth sagar wrote:
>
> def userProfile(models.Model):
>   user=models.OneToOneField(User,primary_key=True)
>"""
>Other stuff
>"""
> I can query it like this
> x = userProfile.objects.get(user__id=1)(Assuming this exists)
>
> when I do a connection.queries a single query is executed.When I try to
> access the username i.e x.user.username a new query is executed again when
> I see connection.queries? Is this the expected behavior. Wouldn't this be
> bad if we have huge databases? I have a scenario where some classes have
> common information and then they have different fields based on their
> classes. I have tested this OneToOneField by the above example and for some
> reason reluctant to use this because of the new query? The other approach
> would be abstract base classes where information stored in the db would be
> duplicated but the additional query can be saved I think any thoughts?
> --
> You received this message because you are subscribed 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/afb76a5c-30c7-45f0-8f8a-96e1d30e731c%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/afb76a5c-30c7-45f0-8f8a-96e1d30e731c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
> --
> This message has been scanned for viruses and dangerous content by
> *E.F.A. Project* <http://www.efa-project.org>, and is believed to be
> clean.
> Click here to report this message as spam.
> <http://lsefa1.linear-systems.com/cgi-bin/learn-msg.cgi?id=7A10B100055.A4314&token=87bb7abc7d6c783361ca22c1c9acd24b>
>
>
> --
> You received this message because you are subscribed 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/84470c00-3058-3c5e-d947-1ee6e231f0b6%40linear-systems.com
> <https://groups.google.com/d/msgid/django-users/84470c00-3058-3c5e-d947-1ee6e231f0b6%40linear-systems.com?utm_medium=email&utm_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/CAMMZq8OP6yAoB%3D%2BC%3Dv5bMKZuLDedLs-ORHiTk970G5DTgp9a%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ldap for django

2018-08-31 Thread vineeth sagar
Wow Vineet Kothari very insightful, why do you have to be a dick?

On Aug 31, 2018 9:57 PM, "Vineet Kothari" 
wrote:

> It is not lodap is ldap
>
> Sent from my Huawei Mobile
>
>
>  Original Message 
> Subject: Ldap for django
> From: soumyajit banerjee
> To: Django users
> CC:
>
>
> Hi,
>
> I am new in django python. I want to set up lodap authentication for my
> django app. Could you please help me. I am using python 3.6 with django 2.1
>
> --
> You received this message because you are subscribed 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/73bd4a1c-86d8-4763-90d7-b7415fec992c%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/-nsggnw31f0154qz1l9-p4sxo1jkikmy-gx1x3hec6xce-9rcgqo-
> axqdp5y85rvjsfpr41jveqvhp3fxin-of4z78-w3oew795cdywcydz51tim2qu-c546dg-
> vr5rvajbx5e5gavqmax8lpqg-vxozcx.1535732867097%40email.android.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/CAMMZq8MfGQiBdEpN005uEEf%3D58p5YuASLWtKX5CuW3JuqohFmA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


I don't clearly know how to name my issue, please read the body.

2018-09-09 Thread vineeth sagar
I have a form class like this, if the db is not populated I skip that 
field, in the future when something thaat might trigger a d population 
happens and I try to render this form, it doesn't recognise the update, but 
once I restart the development server it renders with the newly added 
field? Is this how it's supposed to happen?  How Can I overcome this? In 
production I cant just start/stop the server right?  can anyone help me 
with this? Thank you

class Schedule(...):

   try:
mails = forms.ModelChoiceField(queryset=FetchFrom.objects.all(),
to_field_name="mail",empty_label=None,initial=FetchFrom.objects.latest("id"
))
except Exception as e:
mails=None

-- 
You received this message because you are subscribed 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/8cd9ab46-ef1b-479a-8843-950ceb6820cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Possible bug while using migrate or maybe not.

2018-09-18 Thread vineeth sagar

>
> So I had a migration which can be found below, so when I was applying the 
> migration I get this error  You can't delete all columns with ALTER TABLE; 
> use DROP TABLE instead  That makes sense because I have only a single 
> column. When I use the code sample 2 it works nicely.  Can anyone explain 
> the motivation behind removing fields first and then deleting a model,One 
> case I think of is seeing if the deletion of a field is valid(In case of 
> foreign keys and models.PROTECT), wouldn't sql throw an error anyway. So if 
> this is indeed a bug/Improvement I will be glad to help, if it isn't I 
> would be happy with anyone explaining why this would/should be the way to 
> delete models.



Code Sample 1

class Migration(migrations.Migration):

dependencies = [
('login', '0003_session'),
]

operations = [
migrations.RemoveField(
model_name='session',
name='session_ptr',
),
migrations.DeleteModel(
name='Session',
),
]

 
Code Sample 2

class Migration(migrations.Migration):

dependencies = [
('login', '0003_session'),
]

operations = [
migrations.DeleteModel(
name='Session',
),
]

-- 
You received this message because you are subscribed 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/00bb8f64-0174-4e01-b19f-5c91fad6b8d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Code distribution to customers.

2018-10-09 Thread vineeth sagar
We deploy our web applications on the infrastructure provided by the 
customer, how do you keep the code non-accessible to others. WHAT are the 
strategies you use. It doesn't have to be fool proof just it should become 
very hard to look at the code. Any ideas?

-- 
You received this message because you are subscribed 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/566c79a7-db61-4104-a1de-d74ba2e73ff0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Connecting Sql server to Django

2018-10-11 Thread vineeth sagar
Which version of django are you using, django-mssql only supports Django
until 1.8 and it's not under active development.
https://pypi.org/project/django-pyodbc-azure/ use this instead, this works
with ms-sql as I use this at work and if you go to the bitbucket repo
 you'll find the same thing I have explained you.

Apart from that I was forced to use ms-sql at work, what's your reason to
use SQL server?

regards
Vineeth

On Oct 12, 2018 9:56 AM, "Rakhee Menon"  wrote:

>
>
> Hi Everyone,
>
> In my project I want to connect SQL Server 2014 with django, I tried with
> the given link,
>
>https://django-mssql.readthedocs.io/en/latest/quickstart.html
>
> but it shows some error like,
>
> import pythoncom
> ImportError: No module named 'pythoncom''
>
> When I goggled the error it says download pywin32 but I didn't get any
> file or link to download .Please could anyone help me out with this issue.
>
> Thanks in Advance
> Rakhee
>
> --
> You received this message because you are subscribed 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/b1fe3c06-4e5e-45f7-b675-d4751b94337f%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/CAMMZq8NZkpGZ%3D1TAN9Jr45w2N5VUv6ANJPu858dRuVsS%3D1jpYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Connecting Sql server to Django

2018-10-12 Thread vineeth sagar
I don't know if it works for 1.8, you would've tested it by now. The link I
haven given is a current method to connect with sql server with newer
versions of django, also I think it's about time your company updated your
django version.  For 2.1 the link I have given works seemlessly.


On Oct 12, 2018 5:38 PM, "Jason"  wrote:

> well, considering that 1.8 is no longer supported, you're not getting any
> backports and updates.  which if you're doing a production level app, is
> pretty bad.
>
> Unfortunately, seems if you want to use the recent LTS or newer versions,
> SQL server is not an option unless you're willing to update those packages
> yourself for compatibility.
>
> --
> You received this message because you are subscribed 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/078b932f-fde5-4eb5-9d59-4d66f43ff6f0%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/CAMMZq8OKW5ODFZpcxHhJKF1RBKrBQWGB1dDKCd7iJ6bRc%3DcDrw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Connecting Sql server to Django

2018-10-14 Thread vineeth sagar
Okay Did you put the app in installed_apps in settings.py of your project?
Also you are saying you're new to django why would you want to use a ms-sql
server as the DB of you're choice? Not something as Postgres or mySQL which
have good docs in the Django documentation. I think the above fix should
(?) Solve your issue. Maybe all the migrations have been created you have
to python manage.py migrate.

On Oct 14, 2018 10:22 PM, "Pradeep Singh"  wrote:

> i am newbie in the django..
>
> On Sun, 14 Oct 2018 at 22:21, Pradeep Singh  wrote:
>
>> please help me why i am getting no change detected
>>
>> On Sat, 13 Oct 2018 at 01:33, Gurmeet Kaur 
>> wrote:
>>
>>> I did it in my project. Use pyodbc to connect to sql server and i am
>>> using django 2.0.8
>>>
>>> On Fri, Oct 12, 2018, 11:04 AM Pradeep Singh 
>>> wrote:
>>>
>>>> bro...will you help me ...
>>>> i am getting django 404 error ...please tell how to fix it...
>>>> i am using python 3.6 + django 1.11
>>>>
>>>> On Fri, 12 Oct 2018 at 19:35, vineeth sagar 
>>>> wrote:
>>>>
>>>>> I don't know if it works for 1.8, you would've tested it by now. The
>>>>> link I haven given is a current method to connect with sql server with
>>>>> newer versions of django, also I think it's about time your company 
>>>>> updated
>>>>> your django version.  For 2.1 the link I have given works seemlessly.
>>>>>
>>>>>
>>>>> On Oct 12, 2018 5:38 PM, "Jason"  wrote:
>>>>>
>>>>>> well, considering that 1.8 is no longer supported, you're not getting
>>>>>> any backports and updates.  which if you're doing a production level app,
>>>>>> is pretty bad.
>>>>>>
>>>>>> Unfortunately, seems if you want to use the recent LTS or newer
>>>>>> versions, SQL server is not an option unless you're willing to update 
>>>>>> those
>>>>>> packages yourself for compatibility.
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed 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/078b932f-fde5-4eb5-9d59-4d66f43ff6f0%
>>>>>> 40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/django-users/078b932f-fde5-4eb5-9d59-4d66f43ff6f0%40googlegroups.com?utm_medium=email&utm_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/CAMMZq8OKW5ODFZpcxHhJKF1RBKrBQ
>>>>> WGB1dDKCd7iJ6bRc%3DcDrw%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CAMMZq8OKW5ODFZpcxHhJKF1RBKrBQWGB1dDKCd7iJ6bRc%3DcDrw%40mail.gmail.com?utm_medium=email&utm_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 

Re: Template Issues

2018-10-21 Thread vineeth sagar
Do you mean bootstrap? STL doesn't care about that and it's not clear what
you mean. Can you share the code so that we can help you.

On Oct 22, 2018 12:14 AM, "Dennis Alabi"  wrote:

> i am Building Django 2.0 Web Applications, template is not rendering with
> boottrap3.
>
> --
> You received this message because you are subscribed 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/47edff6d-c85e-4a54-af3e-67736f2d72fe%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/CAMMZq8MU_kmUgC5TnDgYWenD8K%2BZed9RJ-Q7R3jvpGhq_qj-Lw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: I Suck

2018-10-24 Thread vineeth sagar
Hi,

This kind of attitude gets you no where my man, Programming is supposed to
be hard. You pick-up things every day. First focus on your weaknesses and
then work your way up. If you don't have good python experience learn
python first and then comeback to django. If there is some part of django
you don't understand read the docs like a thousand times or even post it
here people are glad to help. try this as a last resort
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django Be
patient no one masters something by doing a udemy course or a week or a
month. See this video https://www.youtube.com/watch?v=hIJdFxYlEKE



On Wed, Oct 24, 2018 at 8:05 PM Edson Rodrigues 
wrote:

> This is just an outburst. I have been trying to learn Django for months
> and I do not learn. I already paid for a course at Udemy, followed
> tutorials on YouTube, followed the Django Project tutorial and nothing
> worked to me. I am a failure as a programmer / developer. :(
>
> --
> You received this message because you are subscribed 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/15ac9bcf-7b41-40a0-ae59-46fc915e03d2%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/CAMMZq8MincB3mJkJ2PDz8NTQAMmwq9vYSDRYjuRLyer7r3tyiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Link ID's To Detail Page

2018-11-07 Thread vineeth sagar
I think it should be url 'kpi_detail' incident_id=incident.id" and for the
other one it should be url 'kpi_eftdetail' eftlead=eftlead.id" . I think
you get the idea. This won't solve it if you copy paste but it's a step in
the right path

On Nov 7, 2018 8:20 PM, "Gregory Strydom" 
wrote:

> Hi there.
>
> I am really not sure how to phrase this questions so I will just do my
> best.
>
> On the homepage of my app I have a table with information. Most of the
> information in each cell is also a link to a details page like so:
>
> {{ incident.ir_num
> }}
>
> What I am struggling to get working is adding another link to a different
> cell in the same table.
>
> {{
> incident.eft_lead}}
>
> My 2 urls are set us as such:
>
> url(r'^detail/(?P\d+)$', views.incident_detail,
> name='kpi_detail'),
>
> url(r'^eftlead/(?P\d+)$', views.eftlead_detail,
> name='kpi_eftdetail')
>
> My index view is like so:
>
> def kpi_index(request):
>   context = dict()
>   context['incidents'] = KPIIncidents.objects.all()
>   return render(request, 'kpi/index.html', context)
>
> If I set everything up like that I am getting an error of no reverse match
> on the index page. I think  the problem I am having is  I am not setting up
> the eft_lead link properly in the index view, but I am not sure how I would
> go about this.
>
> It is very difficult to explain without showing my whole source code I
> think but I am not sure how to do that on Google groups.
>
> Any help would be much appreciated. Thank you!
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/6ac26c7e-be21-468c-9146-25be6b28ee57%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/CAMMZq8OVCN_ivJwDCzzX6yp1m%2Boy_0oLSdAsMcvQThwXQioc3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error installing mysqldb module !

2018-11-11 Thread vineeth sagar
Ah using Windows the most braindead operating system the world has ever
seen. My coworker had this problem and he solved it using the following
command

pip install --only-binary :all: mysqlclient

Good luck!


On Nov 11, 2018 5:01 PM, "Swetank Subham Roy" 
wrote:

> First of all you have to install 'libmysqlclient' package globally then
> 'mysqlclient-dev' in project environment
>
> On Sun, Nov 11, 2018, 4:42 PM Ansh Srivastava  wrote:
>
>> Hey there! I m tryin' to connect mysql database with django, While doin'
>> it number of errors prompted out as below:-
>> Error sayin' :(install visual c++ for installing other mysql modules).
>> However, I installed visual c++ and the error was get sorted out too. But,
>> now this new mess came around sayin' :- 
>> (django.core.exceptions.ImproperlyConfigured:
>> Error loading MySQLdb module.
>> Did you install mysqlclient?).
>> But when I m tryin' to install mysqldb through pip, another creepy thing
>> comes up:-
>>   (Could not find a version that satisfies the requirement mysqldb (from
>> versions
>> : )
>> (No matching distribution found for mysqldb)
>>  Any help would be appreciated.
>>
>>
>> [image: Mailtrack]
>> 
>>  Sender
>> notified by
>> Mailtrack
>> 
>>  11/11/18,
>> 4:41:24 PM
>>
>> --
>> You received this message because you are subscribed 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/CAHMQ533yuHTkgh_bZT__jieb9t%3D3j2j5woqxRfjbDPZWVvCJfg%
>> 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/CADQ%3DdpoaXC0Orpsbxo2i%2BYJ%3DQvzekBi%
> 2B9UyV1HighpvsyizFmQ%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/CAMMZq8OACPja5r12zbcnXX4obF%2BO3L82Yh8WOwzdvKGa9xpYQg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2018-11-15 Thread vineeth sagar
Try reducing the connection max age to a lesser value like 3600 maybe?

On Nov 15, 2018 2:41 PM, "prateek gupta"  wrote:

> Hi,
>
> My all db have 20 gb of size.
>
> On Thursday, November 15, 2018 at 12:27:27 PM UTC+5:30, Krishnasagar
> Subhedarpage wrote:
>>
>> Hi Prateek,
>>
>> Did you check disk info of server instance? What's disk consumption?
>>
>> Regards,
>> Krishnasagar Subhedarpage
>>
>>
>>
>>
>> On Thu, 15 Nov 2018 at 12:09, prateek gupta  wrote:
>>
>>> It is strange again, now I am getting the same error.
>>> Till morning it was working fine but now it is again showing same error.
>>>
>>> On Wednesday, November 14, 2018 at 7:07:46 PM UTC+5:30, Jason wrote:

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

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@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/ms
>>> gid/django-users/9bd1c72a-7c97-49b5-8a37-646e49dbc785%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/cf5bdd99-6e58-430f-85bd-6df249378f2c%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/CAMMZq8Ou8-Z8D80XLRDO80HpBfyEmPeXEy9E%3DjgF6JnVE5SC6A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to fix TypeError: __init__() missing 1 required positional argument: 'on_delete'

2018-11-22 Thread vineeth sagar
For a foreign keys you have to specify an on_delete attribute,

food=models.ForiegnKey(Food,on_delete=models.CASCADE)

If a row in the parent table(food for example) is deleted this will cause
the row/s that refers to that particular food item in your Restraunt model
be deleted.

on_delete can be given other options as SET_NULL,DO_NOTHING. Refer the docs
they are extensive on this topic.

On Nov 23, 2018 1:20 AM, "Abba Haruna"  wrote:

> from django.db import models
>
> class Food(models.Model):
> name = models.CharField(max_length=30)
> picture = models.ImageField(upload_to='images/', null=True)
> def __unicode__(self):
> return self.name
> class Town(models.Model):
> name = models.CharField(max_length=30)
>
> def __unicode__(self):
> return self.name
> class Restaurant(models.Model):
> name = models.CharField(max_length=100)
> desc = models.CharField(max_length=100)
> menu = models.CharField(max_length=100)
> web = models.CharField(max_length=100)
> phone = models.CharField(max_length=40)
> address = models.CharField(max_length=100)
> post_code = models.CharField(max_length=20)
> picture = models.ImageField(upload_to='images/', null=True)
> map = models.ImageField(upload_to='images/', null=True)
> gmap_url = models.CharField(max_length=200, null=True)
> food = models.ForeignKey(Food)
> town = models.ForeignKey(Town)
> STARS = ((1,'one'),
> (2,'two'),
> (3,'three'),
> (4,'four'),)
> votes = models.IntegerField(choices=STARS, default=4)
> def __unicode__(self):
> return self.name
> def __str__(self):
>
> --
> You received this message because you are subscribed 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/de6ad3df-e330-43e1-875a-58895e245851%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/CAMMZq8OuObyCbPXrwb47uSozX3sk7RXPiHaJnZxV%3Dk6SPjYpuA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to hide the password of postgresql in settings.py

2018-11-30 Thread vineeth sagar
Use this

https://github.com/jpadilla/django-dotenv/blob/master/README.rst

If you have copied the GitHub template of .gitignore then the .env won't be
in your history of vs. I used this in production and development without a
single problem.

On Nov 30, 2018 11:54 PM, "Carsten Fuchs"  wrote:

> Am 30.11.18 um 18:50 schrieb Sandip Nath:
>
>> I am a newbie to Django. Using Postgresql for CRUD operations. Although
>> its working but I need to write the password of my Postgresql server in the
>> settings.py. How can I hide that without hampering the operation?
>>
>>
> In your settings.py, you could write something like:
>
>
> from my_site import localconfig
>
> DEBUG = localconfig.DEBUG
> SECRET_KEY = localconfig.SECRET_KEY
>
> # Rest of normal settings.py file
> # ...
>
>
> and in a minmal my_site/localconfig.py file:
>
>
> DEBUG = True
> SECRET_KEY = '...'
>
>
> For completeness, be aware that some people consider local config files an
> anti pattern. Personally, I've never found the arguments convincing, but
> use at your own discretion.
>
> Best regards,
> Carsten
>
> --
> You received this message because you are subscribed 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/ddc528e3-12c1-6ba4-0f5b-1be7dad54acd%40cafu.de.
> 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/CAMMZq8MHS7Jv5-D0nwaFYf5fxrsuj1c7sQ94yv8nZqMJiTFqNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: form.is_valid() is always return false please help

2019-08-24 Thread vineeth sagar
What does form.errors show. Just see what print(form.errors) tells you. It
should be pretty obvious.

On Sun, 25 Aug 2019, 00:30 mohammad mehrani,  wrote:

> awesome!!! and i like it
>
> On Fri, Aug 23, 2019 at 12:27 AM Shubham Chauhan <
> shubham.chauhan...@gmail.com> wrote:
>
>> form.is_valid() is always return false 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/206e042a-738b-4491-8f4d-9c172f61e56d%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/CAJWh1t2SnYwsXKO2BL%2BEDa%2BW14QSkL2EOvnXSKOoP-RrdMbWRA%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/CAMMZq8NPDqktzG5_%3DibwVCL-eJiVVTAUA6srfL4A%2BZRKaL2-0Q%40mail.gmail.com.