Giter Site home page Giter Site logo

robpco / docker-nginx-uwsgi-flask-mssql Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 5.0 37 KB

Docker image for Python Flask Apps with official Microsoft SQL Driver, NGINX and uWSGI

Home Page: https://hub.docker.com/r/robpco/nginx-uwsgi-flask-mssql

License: Apache License 2.0

Python 6.22% Shell 37.52% Dockerfile 56.26%
docker-image python flask sql-driver uwsgi-nginx nginx uwsgi flask-server flask-image odbc-driver

docker-nginx-uwsgi-flask-mssql's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docker-nginx-uwsgi-flask-mssql's Issues

Error: ('IM004', "[IM004] [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed (0) (SQLDriverConnect)")

Getting this error when attempting to use pyodbc in my django application. When I ssh into the container I am able to use sqlcmd to execute queries using the same connection string as my app is using. I've seen that this might be a permissions issue however I have configured everything to run as root and am still seeing this issue.

Stack Trace:

Error: ('IM004', "[IM004] [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed (0) (SQLDriverConnect)")
File "django/db/backends/base/base.py", line 199, in ensure_connection
self.connect()
File "django/db/backends/base/base.py", line 171, in connect
self.connection = self.get_new_connection(conn_params)
File "sql_server/pyodbc/base.py", line 303, in get_new_connection
timeout=timeout)
Error: ('IM004', "[IM004] [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed (0) (SQLDriverConnect)")
File "django/core/handlers/exception.py", line 39, in inner
response = get_response(request)
File "django/core/handlers/base.py", line 249, in _legacy_get_response
response = self._get_response(request)
File "django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "app/views.py", line 40, in app_index
dom = DomainNames.availabledoms.random()
File "app/models.py", line 81, in random
count = self.aggregate(count=Count('id'))['count']
File "django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "django/db/models/query.py", line 356, in aggregate
return query.get_aggregation(self.db, kwargs.keys())
File "django/db/models/sql/query.py", line 457, in get_aggregation
result = compiler.execute_sql(SINGLE)
File "django/db/models/sql/compiler.py", line 824, in execute_sql
sql, params = self.as_sql()
File "sql_server/pyodbc/compiler.py", line 73, in as_sql
extra_select, order_by, group_by = self.pre_sql_setup()
File "django/db/models/sql/compiler.py", line 46, in pre_sql_setup
self.setup_query()
File "django/db/models/sql/compiler.py", line 37, in setup_query
self.select, self.klass_info, self.annotation_col_map = self.get_select()
File "django/db/models/sql/compiler.py", line 226, in get_select
ret.append((col, self.compile(col, select_format=True), alias))
File "sql_server/pyodbc/compiler.py", line 213, in compile
return super(SQLCompiler, self).compile(node, select_format)
File "django/db/models/sql/compiler.py", line 351, in compile
sql, params = vendor_impl(self, self.connection)
File "sql_server/pyodbc/compiler.py", line 23, in _as_sql_count
return self.as_sql(compiler, connection, function='COUNT_BIG')
File "django/db/models/expressions.py", line 517, in as_sql
connection.ops.check_expression_support(self)
File "sql_server/pyodbc/operations.py", line 78, in check_expression_support
if self.connection.sql_server_version < 2008:
File "django/utils/functional.py", line 35, in get
res = instance.dict[self.name] = self.func(instance)
File "sql_server/pyodbc/base.py", line 390, in sql_server_version
with self.temporary_connection() as cursor:
File "python3.6/contextlib.py", line 81, in enter
return next(self.gen)
File "django/db/backends/base/base.py", line 564, in temporary_connection
cursor = self.cursor()
File "django/db/backends/base/base.py", line 231, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "django/db/backends/base/base.py", line 204, in _cursor
self.ensure_connection()
File "django/db/backends/base/base.py", line 199, in ensure_connection
self.connect()
File "django/db/utils.py", line 94, in exit
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "django/db/backends/base/base.py", line 199, in ensure_connection
self.connect()
File "django/db/backends/base/base.py", line 171, in connect
self.connection = self.get_new_connection(conn_params)
File "sql_server/pyodbc/base.py", line 303, in get_new_connection
timeout=timeout)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.