2

I am trying to use the next settings:

DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': 'name',
        'USER': 'user',
        'PASSWORD': 'pw',
        'HOST': 'host',
        'PORT': '1433',
        'CONN_MAX_AGE' : 600,
    }
}

But calling my view where I have 2 simple queries takes always almost the same time - around 1.3sec. Calling the same view but without the queries it takes 100ms. So I think my problem is that every time it opens a new connection to the SQL DB.

Any suggestion why CONN_MAX_AGE doesn't want to work?

Best Regards, Kristian Veselinov

Kristian
  • 738
  • 6
  • 15
  • I have forwarded this question to the author of the adapter. Will keep you posted with his response. – meet-bhagdev May 09 '16 at 16:36
  • hello Kristian, what behavior do you see when you change the value of con_max_age? Do you have an error messages that you can share? – meet-bhagdev May 16 '16 at 06:31
  • Hello, I have no error messages. The problem is just in the slow executing on the first query in the view and every query after the first is a lot faster. I saw the difference easily when debugging. – Kristian May 19 '16 at 07:53
  • Do you use https://github.com/michiya/django-pyodbc-azure or https://pypi.python.org/pypi/django-pyodbc? – meet-bhagdev May 27 '16 at 05:52
  • I am using django-pyodbc-azure – Kristian May 27 '16 at 07:51

1 Answers1

0

Azure has many error with django (and i see it has many error with other services) Ex: error with path (replace url) error with filter,... create_at__month (use for loop to get month and compare ~~) can't close mysql connections (i can't fix it ~~)

I think you should use heroku, it easy to deploy, no error as azure, faster, and have plan free to test