[no subject]

2021-01-20 Thread Salima Begum
Hi all,

We are building website, Here I have written functionality for classifieds
page.
It is loading to slow because of We are prompting distance calculation in
classifieds page. By using distance API matrix based on logged in user zip
code and individual Ad zip codes from query set(database).

```
def classifieds(request):
global dict_time
try:
dict_time = {}
email = request.session.get('email')

# Here we are displaying the classified ads "order by date".
The ads will be sorted by latest date.
classifieds =
vk_classifieds.objects.filter(class_status='1').order_by('-added_date')

count =
vk_classifieds.objects.filter(class_status='1').order_by('-added_date').count()
for i in classifieds:
# diff_time is a child method. By passing 'i' as object in
diff_time.
difrnc_date = diff_time(i)
dict_time[i.id] = difrnc_date

# Pagination for classifieds page.
# classified = random.sample(list(classifieds), k=count)
# print("classified = ", str(classified))
# By default first page
page = request.GET.get('page', 1)
# print("page = ", str(page))
# Per page setting 40 objects.
paginator = Paginator(list(classifieds), 40)
# print("paginator = ", str(paginator))
classified_p = paginator.page(page)
# print(classified_p)
except PageNotAnInteger:
classified_p = paginator.page(1)
except EmptyPage:
classified_p = paginator.page(paginator.num_pages)
except Exception as e:
logging.error(e)
return render(request, "classifieds.html",
  {"Classifieds": classified_p,
 # distance calculation
   "distance": classifieds_dist(email),
   'some_date': dict_time,
   })
return render(request, "classifieds.html", {"Classifieds":
classified_p,
"distance":
classifieds_dist(email),
'some_date': dict_time,
})
```

```

def classifieds_dist(email):
global frm, km
dict_distance = {}

qury = vk_customer.objects.filter(email=email).first()

# From above qury variable we are getting zip of customer.
frm = qury.Zip
# importing json package to calculate the distance
url = "
https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial;
headers = {
'Authorization': "Bearer somevalue",
'User-Agent': "some value",
'Accept': "*/*",
'Cache-Control': "no-cache",
'Postman-Token': "some value",
'Host': "maps.googleapis.com",
'Accept-Encoding': "gzip, deflate",
'Connection': "keep-alive",
'cache-control': "no-cache"
}
classifieds =
vk_classifieds.objects.filter(class_status='1').order_by('-added_date')
for i in classifieds:
# while a user login through his login email we capture his
complete detail into an variable which we given as "qury"
# and after the details are stored into the variable from there we
will filter his starting and destination point as zipcode

# After login his/her based on email we are filtering in
vk_customer table. Then storing in qury variable.

# This zip is getting from vk_classifieds(model in models.py) table.
# 'i' attribute is getting from classifieds() function.
to = i.zip

origin_list = [to]
desination_list = [frm]
# here we used api for calculating the source and destination point
querystring = {"origins": origin_list, "destinations":
desination_list, "departure_time": "now",
   "key": "AIzaSyDhlCiMAEEfoYhkPcOyP0PLqpHsVMmYEXM"}
# here we are passing these headers to the api

# we are capturing the response in variable called response
response = requests.request("GET", url, headers=headers,
params=querystring)
jsondata = response.text
obj = json.loads(jsondata)
list = obj['rows']
if list:
a = list[0].get('elements')
obj2 = a[0].get("distance")
if obj2 is None:
km = "None"
else:
km = obj2["text"]
dict_distance[i.id] = km
l1.append(i.id)
print("id = ", str(i.id))
print("km = ", str(km))
return dict_distance


```

Because of this loading time of classifieds page is to slow. Please help me
to solve this issue.

Thanks
~Salima

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 

Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread panfei
It finally proved a compilation issue, this is the right way to compile
Python 3.9:

1033 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
1034 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib make
1035 make clean
1036 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
1037 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib make
1038 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib make install
1039 /home/felix/.local/python/python-3.9.1/bin/python3
1040 history
[felix@localhost Python-3.9.1]$
/home/felix/.local/python/python-3.9.1/bin/python3
Python 3.9.1 (default, Jan 21 2021, 10:58:50)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> conn = sqlite3.connect(':memory:')
>>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
>>>

Every step should specify the same environment variables.

'Amitesh Sahay' via Django users 
于2021年1月20日周三 下午10:06写道:

> Please read the release notes of the Django version you are using. It will
> be a life saver as well.
>
> Regards,
> Amitesh
>
>
> On Wednesday, 20 January, 2021, 07:35:14 pm IST, Amitesh Sahay <
> amitesh.sa...@yahoo.com> wrote:
>
>
> So, this seems to be a version compatibility issue, a a work around you
> can use some other database(mysql, oracle, etc). This cud save ur day and
> time as well.
>
> Regards,
> Amitesh
>
> On Wednesday, 20 January, 2021, 07:32:59 pm IST, panfei 
> wrote:
>
>
> I have tried, it works in Python 3.6 environment. but I still want to find
> a way (maybe a workaround) to solve this problem.
>
> 'Amitesh Sahay' via Django users 
> 于2021年1月20日周三 下午9:48写道:
>
> Try older version of Python interpreter and see if that works. May be
> consider using 3.6
>
> Regards,
> Amitesh
>
>
> On Wednesday, 20 January, 2021, 05:55:32 pm IST, panfei 
> wrote:
>
>
> I found that, it may not be a Django-related issue, It's more likely a
> Python level issue, but do anyone know how to avoid this problem?:
>
> (venv) [felix@localhost blueprint]$ python
> Python 3.9.1 (default, Jan 20 2021, 14:32:50)
> [GCC 10.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sqlite3
> >>> conn = sqlite3.connect(':memory:')
> >>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
> Traceback (most recent call last):
>   File "", line 1, in 
> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
> higher
> >>> sqlite3.sqlite_version
> '3.34.0'
> >>> sqlite3.version
> '2.6.0'
> >>>
>
>
> panfei  于2021年1月20日周三 下午8:03写道:
>
>
> System environment:
>
> Cent OS 7
> Sqlite3 3.34.0 (Compile from source)
> Python 3.9.1 (Compile from source)
> Django 3.1.5 (Pip install)
>
>
> 1. Compile sqlite3:
> ./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0
> make && make install
>
> 2. Add sqlite3 lib to lib search path:
>
> export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/lib
> export LD_RUN_PATH=/home/felix/.local/sqlite/default/lib
>
> 3. Compile Python 3.9.1
> C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
> --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
> make && make install
>
> 4. Create a venv and install django and start a demo project
> cd /tmp
> /home/felix/.local/python/python-3.9.1/bin/python3 -m venv venv
> source venv/bin/activate
> pip install django
> djagno-admin startproject demo
> cd demo
>
> 4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
> (venv) [felix@localhost blueprint]$ python manage.py shell
> Python 3.9.0 (default, Jan 20 2021, 12:53:25)
> [GCC 10.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>> import sqlite3
> >>> sqlite3.sqlite_version
> '3.34.0'
> >>> sqlite3.version
> '2.6.0'
> >>>
>
> 5. Run the demo project (cannot find the new sqlite version ? strange.):
> (venv) [felix@localhost blueprint]$ python manage.py runserver
> Watching for file changes with StatReloader
> Performing system checks...
>
> System check identified no issues (0 silenced).
> Exception in 

Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread panfei
Thanks for all the suggestions.

'Amitesh Sahay' via Django users 
于2021年1月20日周三 下午10:06写道:

> Please read the release notes of the Django version you are using. It will
> be a life saver as well.
>
> Regards,
> Amitesh
>
>
> On Wednesday, 20 January, 2021, 07:35:14 pm IST, Amitesh Sahay <
> amitesh.sa...@yahoo.com> wrote:
>
>
> So, this seems to be a version compatibility issue, a a work around you
> can use some other database(mysql, oracle, etc). This cud save ur day and
> time as well.
>
> Regards,
> Amitesh
>
> On Wednesday, 20 January, 2021, 07:32:59 pm IST, panfei 
> wrote:
>
>
> I have tried, it works in Python 3.6 environment. but I still want to find
> a way (maybe a workaround) to solve this problem.
>
> 'Amitesh Sahay' via Django users 
> 于2021年1月20日周三 下午9:48写道:
>
> Try older version of Python interpreter and see if that works. May be
> consider using 3.6
>
> Regards,
> Amitesh
>
>
> On Wednesday, 20 January, 2021, 05:55:32 pm IST, panfei 
> wrote:
>
>
> I found that, it may not be a Django-related issue, It's more likely a
> Python level issue, but do anyone know how to avoid this problem?:
>
> (venv) [felix@localhost blueprint]$ python
> Python 3.9.1 (default, Jan 20 2021, 14:32:50)
> [GCC 10.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sqlite3
> >>> conn = sqlite3.connect(':memory:')
> >>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
> Traceback (most recent call last):
>   File "", line 1, in 
> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
> higher
> >>> sqlite3.sqlite_version
> '3.34.0'
> >>> sqlite3.version
> '2.6.0'
> >>>
>
>
> panfei  于2021年1月20日周三 下午8:03写道:
>
>
> System environment:
>
> Cent OS 7
> Sqlite3 3.34.0 (Compile from source)
> Python 3.9.1 (Compile from source)
> Django 3.1.5 (Pip install)
>
>
> 1. Compile sqlite3:
> ./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0
> make && make install
>
> 2. Add sqlite3 lib to lib search path:
>
> export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/lib
> export LD_RUN_PATH=/home/felix/.local/sqlite/default/lib
>
> 3. Compile Python 3.9.1
> C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
> --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
> make && make install
>
> 4. Create a venv and install django and start a demo project
> cd /tmp
> /home/felix/.local/python/python-3.9.1/bin/python3 -m venv venv
> source venv/bin/activate
> pip install django
> djagno-admin startproject demo
> cd demo
>
> 4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
> (venv) [felix@localhost blueprint]$ python manage.py shell
> Python 3.9.0 (default, Jan 20 2021, 12:53:25)
> [GCC 10.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>> import sqlite3
> >>> sqlite3.sqlite_version
> '3.34.0'
> >>> sqlite3.version
> '2.6.0'
> >>>
>
> 5. Run the demo project (cannot find the new sqlite version ? strange.):
> (venv) [felix@localhost blueprint]$ python manage.py runserver
> Watching for file changes with StatReloader
> Performing system checks...
>
> System check identified no issues (0 silenced).
> Exception in thread django-main-thread:
> Traceback (most recent call last):
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
> line 219, in ensure_connection
> self.connect()
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
> line 26, in inner
> return func(*args, **kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
> line 200, in connect
> self.connection = self.get_new_connection(conn_params)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
> line 26, in inner
> return func(*args, **kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py",
> line 215, in get_new_connection
> create_deterministic_function('django_date_extract', 2,
> _sqlite_datetime_extract)
> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
> higher
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
>   File
> "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", line
> 950, in _bootstrap_inner
> self.run()
>   File
> "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", line
> 888, in run
> self._target(*self._args, **self._kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/autoreload.py",
> line 53, in wrapper
> 

Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread 'Amitesh Sahay' via Django users
Please read the release notes of the Django version you are using. It will be a 
life saver as well.


Regards,
Amitesh  

On Wednesday, 20 January, 2021, 07:35:14 pm IST, Amitesh Sahay 
 wrote:  
 
 So, this seems to be a version compatibility issue, a a work around you can 
use some other database(mysql, oracle, etc). This cud save ur day and time as 
well.


Regards,
Amitesh 
On Wednesday, 20 January, 2021, 07:32:59 pm IST, panfei  
wrote:  
 
 I have tried, it works in Python 3.6 environment. but I still want to find a 
way (maybe a workaround) to solve this problem.

'Amitesh Sahay' via Django users  于2021年1月20日周三 
下午9:48写道:

Try older version of Python interpreter and see if that works. May be  consider 
using 3.6


Regards,
Amitesh  

On Wednesday, 20 January, 2021, 05:55:32 pm IST, panfei  
wrote:  
 
 I found that, it may not be a Django-related issue, It's more likely a Python 
level issue, but do anyone know how to avoid this problem?:
(venv) [felix@localhost blueprint]$ python
Python 3.9.1 (default, Jan 20 2021, 14:32:50) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> conn = sqlite3.connect(':memory:')
>>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
Traceback (most recent call last):
  File "", line 1, in 
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>> 


panfei  于2021年1月20日周三 下午8:03写道:


System environment:
Cent OS 7
Sqlite3 3.34.0 (Compile from source)Python 3.9.1 (Compile from source)
Django 3.1.5 (Pip install)


1. Compile sqlite3:./configure 
--prefix=/home/felix/.local/sqlite/sqlite-3.34.0make && make install
2. Add sqlite3 lib to lib search path:
export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/libexport 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib
3. Compile Python 
3.9.1C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizationsmake && 
make install
4. Create a venv and install django and start a demo projectcd /tmp
/home/felix/.local/python/python-3.9.1/bin/python3 -m venv venvsource 
venv/bin/activatepip install djangodjagno-admin startproject democd demo
4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
(venv) [felix@localhost blueprint]$ python manage.py shell
Python 3.9.0 (default, Jan 20 2021, 12:53:25) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>> 

5. Run the demo project (cannot find the new sqlite version ? strange.):(venv) 
[felix@localhost blueprint]$ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
 line 219, in ensure_connection
    self.connect()
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
 line 26, in inner
    return func(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
 line 200, in connect
    self.connection = self.get_new_connection(conn_params)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
 line 26, in inner
    return func(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py",
 line 215, in get_new_connection
    create_deterministic_function('django_date_extract', 2, 
_sqlite_datetime_extract)
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", 
line 950, in _bootstrap_inner
    self.run()
  File "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", 
line 888, in run
    self._target(*self._args, **self._kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/autoreload.py",
 line 53, in wrapper
    fn(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/commands/runserver.py",
 line 121, in inner_run
    self.check_migrations()
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/base.py",
 line 459, in check_migrations
    

Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread 'Amitesh Sahay' via Django users
So, this seems to be a version compatibility issue, a a work around you can use 
some other database(mysql, oracle, etc). This cud save ur day and time as well.


Regards,
Amitesh 
On Wednesday, 20 January, 2021, 07:32:59 pm IST, panfei  
wrote:  
 
 I have tried, it works in Python 3.6 environment. but I still want to find a 
way (maybe a workaround) to solve this problem.

'Amitesh Sahay' via Django users  于2021年1月20日周三 
下午9:48写道:

Try older version of Python interpreter and see if that works. May be  consider 
using 3.6


Regards,
Amitesh  

On Wednesday, 20 January, 2021, 05:55:32 pm IST, panfei  
wrote:  
 
 I found that, it may not be a Django-related issue, It's more likely a Python 
level issue, but do anyone know how to avoid this problem?:
(venv) [felix@localhost blueprint]$ python
Python 3.9.1 (default, Jan 20 2021, 14:32:50) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> conn = sqlite3.connect(':memory:')
>>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
Traceback (most recent call last):
  File "", line 1, in 
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>> 


panfei  于2021年1月20日周三 下午8:03写道:


System environment:
Cent OS 7
Sqlite3 3.34.0 (Compile from source)Python 3.9.1 (Compile from source)
Django 3.1.5 (Pip install)


1. Compile sqlite3:./configure 
--prefix=/home/felix/.local/sqlite/sqlite-3.34.0make && make install
2. Add sqlite3 lib to lib search path:
export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/libexport 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib
3. Compile Python 
3.9.1C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizationsmake && 
make install
4. Create a venv and install django and start a demo projectcd /tmp
/home/felix/.local/python/python-3.9.1/bin/python3 -m venv venvsource 
venv/bin/activatepip install djangodjagno-admin startproject democd demo
4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
(venv) [felix@localhost blueprint]$ python manage.py shell
Python 3.9.0 (default, Jan 20 2021, 12:53:25) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>> 

5. Run the demo project (cannot find the new sqlite version ? strange.):(venv) 
[felix@localhost blueprint]$ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
 line 219, in ensure_connection
    self.connect()
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
 line 26, in inner
    return func(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
 line 200, in connect
    self.connection = self.get_new_connection(conn_params)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
 line 26, in inner
    return func(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py",
 line 215, in get_new_connection
    create_deterministic_function('django_date_extract', 2, 
_sqlite_datetime_extract)
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", 
line 950, in _bootstrap_inner
    self.run()
  File "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", 
line 888, in run
    self._target(*self._args, **self._kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/autoreload.py",
 line 53, in wrapper
    fn(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/commands/runserver.py",
 line 121, in inner_run
    self.check_migrations()
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/base.py",
 line 459, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/executor.py",
 line 18, in __init__
    

Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread panfei
The exception is raised from inside the C implementation in Python when
checking sqlite3 version check.
In Django:

@async_unsafe
def get_new_connection(self, conn_params):
conn = Database.connect(**conn_params)
if PY38:
create_deterministic_function = functools.partial(
conn.create_function,
deterministic=True,
)
else:
create_deterministic_function = conn.create_function

if PY38 (means python version greater or equal to 3.8) is True, the new
created function will call conn.create_function with deterministic=True, so
the exception happens.

panfei  于2021年1月20日周三 下午9:54写道:

> I have tried, it works in Python 3.6 environment. but I still want to find
> a way (maybe a workaround) to solve this problem.
>
> 'Amitesh Sahay' via Django users 
> 于2021年1月20日周三 下午9:48写道:
>
>> Try older version of Python interpreter and see if that works. May be
>> consider using 3.6
>>
>> Regards,
>> Amitesh
>>
>>
>> On Wednesday, 20 January, 2021, 05:55:32 pm IST, panfei <
>> cnwe...@gmail.com> wrote:
>>
>>
>> I found that, it may not be a Django-related issue, It's more likely a
>> Python level issue, but do anyone know how to avoid this problem?:
>>
>> (venv) [felix@localhost blueprint]$ python
>> Python 3.9.1 (default, Jan 20 2021, 14:32:50)
>> [GCC 10.2.0] on linux
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import sqlite3
>> >>> conn = sqlite3.connect(':memory:')
>> >>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
>> Traceback (most recent call last):
>>   File "", line 1, in 
>> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
>> higher
>> >>> sqlite3.sqlite_version
>> '3.34.0'
>> >>> sqlite3.version
>> '2.6.0'
>> >>>
>>
>>
>> panfei  于2021年1月20日周三 下午8:03写道:
>>
>>
>> System environment:
>>
>> Cent OS 7
>> Sqlite3 3.34.0 (Compile from source)
>> Python 3.9.1 (Compile from source)
>> Django 3.1.5 (Pip install)
>>
>>
>> 1. Compile sqlite3:
>> ./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0
>> make && make install
>>
>> 2. Add sqlite3 lib to lib search path:
>>
>> export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/lib
>> export LD_RUN_PATH=/home/felix/.local/sqlite/default/lib
>>
>> 3. Compile Python 3.9.1
>> C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
>> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
>> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
>> --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
>> make && make install
>>
>> 4. Create a venv and install django and start a demo project
>> cd /tmp
>> /home/felix/.local/python/python-3.9.1/bin/python3 -m venv venv
>> source venv/bin/activate
>> pip install django
>> djagno-admin startproject demo
>> cd demo
>>
>> 4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
>> (venv) [felix@localhost blueprint]$ python manage.py shell
>> Python 3.9.0 (default, Jan 20 2021, 12:53:25)
>> [GCC 10.2.0] on linux
>> Type "help", "copyright", "credits" or "license" for more information.
>> (InteractiveConsole)
>> >>> import sqlite3
>> >>> sqlite3.sqlite_version
>> '3.34.0'
>> >>> sqlite3.version
>> '2.6.0'
>> >>>
>>
>> 5. Run the demo project (cannot find the new sqlite version ? strange.):
>> (venv) [felix@localhost blueprint]$ python manage.py runserver
>> Watching for file changes with StatReloader
>> Performing system checks...
>>
>> System check identified no issues (0 silenced).
>> Exception in thread django-main-thread:
>> Traceback (most recent call last):
>>   File
>> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
>> line 219, in ensure_connection
>> self.connect()
>>   File
>> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
>> line 26, in inner
>> return func(*args, **kwargs)
>>   File
>> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
>> line 200, in connect
>> self.connection = self.get_new_connection(conn_params)
>>   File
>> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
>> line 26, in inner
>> return func(*args, **kwargs)
>>   File
>> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py",
>> line 215, in get_new_connection
>> create_deterministic_function('django_date_extract', 2,
>> _sqlite_datetime_extract)
>> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
>> higher
>>
>> The above exception was the direct cause of the following exception:
>>
>> Traceback (most recent call last):
>>   File
>> "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", line
>> 950, in _bootstrap_inner
>> self.run()
>>   File
>> "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", line
>> 888, in run

Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread panfei
I have tried, it works in Python 3.6 environment. but I still want to find
a way (maybe a workaround) to solve this problem.

'Amitesh Sahay' via Django users 
于2021年1月20日周三 下午9:48写道:

> Try older version of Python interpreter and see if that works. May be
> consider using 3.6
>
> Regards,
> Amitesh
>
>
> On Wednesday, 20 January, 2021, 05:55:32 pm IST, panfei 
> wrote:
>
>
> I found that, it may not be a Django-related issue, It's more likely a
> Python level issue, but do anyone know how to avoid this problem?:
>
> (venv) [felix@localhost blueprint]$ python
> Python 3.9.1 (default, Jan 20 2021, 14:32:50)
> [GCC 10.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sqlite3
> >>> conn = sqlite3.connect(':memory:')
> >>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
> Traceback (most recent call last):
>   File "", line 1, in 
> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
> higher
> >>> sqlite3.sqlite_version
> '3.34.0'
> >>> sqlite3.version
> '2.6.0'
> >>>
>
>
> panfei  于2021年1月20日周三 下午8:03写道:
>
>
> System environment:
>
> Cent OS 7
> Sqlite3 3.34.0 (Compile from source)
> Python 3.9.1 (Compile from source)
> Django 3.1.5 (Pip install)
>
>
> 1. Compile sqlite3:
> ./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0
> make && make install
>
> 2. Add sqlite3 lib to lib search path:
>
> export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/lib
> export LD_RUN_PATH=/home/felix/.local/sqlite/default/lib
>
> 3. Compile Python 3.9.1
> C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
> --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
> make && make install
>
> 4. Create a venv and install django and start a demo project
> cd /tmp
> /home/felix/.local/python/python-3.9.1/bin/python3 -m venv venv
> source venv/bin/activate
> pip install django
> djagno-admin startproject demo
> cd demo
>
> 4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
> (venv) [felix@localhost blueprint]$ python manage.py shell
> Python 3.9.0 (default, Jan 20 2021, 12:53:25)
> [GCC 10.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>> import sqlite3
> >>> sqlite3.sqlite_version
> '3.34.0'
> >>> sqlite3.version
> '2.6.0'
> >>>
>
> 5. Run the demo project (cannot find the new sqlite version ? strange.):
> (venv) [felix@localhost blueprint]$ python manage.py runserver
> Watching for file changes with StatReloader
> Performing system checks...
>
> System check identified no issues (0 silenced).
> Exception in thread django-main-thread:
> Traceback (most recent call last):
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
> line 219, in ensure_connection
> self.connect()
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
> line 26, in inner
> return func(*args, **kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
> line 200, in connect
> self.connection = self.get_new_connection(conn_params)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
> line 26, in inner
> return func(*args, **kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py",
> line 215, in get_new_connection
> create_deterministic_function('django_date_extract', 2,
> _sqlite_datetime_extract)
> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
> higher
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
>   File
> "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", line
> 950, in _bootstrap_inner
> self.run()
>   File
> "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", line
> 888, in run
> self._target(*self._args, **self._kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/autoreload.py",
> line 53, in wrapper
> fn(*args, **kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/commands/runserver.py",
> line 121, in inner_run
> self.check_migrations()
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/base.py",
> line 459, in check_migrations
> executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/executor.py",
> line 18, in __init__
> self.loader = 

Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread 'Amitesh Sahay' via Django users
Try older version of Python interpreter and see if that works. May be  consider 
using 3.6


Regards,
Amitesh  

On Wednesday, 20 January, 2021, 05:55:32 pm IST, panfei  
wrote:  
 
 I found that, it may not be a Django-related issue, It's more likely a Python 
level issue, but do anyone know how to avoid this problem?:
(venv) [felix@localhost blueprint]$ python
Python 3.9.1 (default, Jan 20 2021, 14:32:50) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> conn = sqlite3.connect(':memory:')
>>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
Traceback (most recent call last):
  File "", line 1, in 
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>> 


panfei  于2021年1月20日周三 下午8:03写道:


System environment:
Cent OS 7
Sqlite3 3.34.0 (Compile from source)Python 3.9.1 (Compile from source)
Django 3.1.5 (Pip install)


1. Compile sqlite3:./configure 
--prefix=/home/felix/.local/sqlite/sqlite-3.34.0make && make install
2. Add sqlite3 lib to lib search path:
export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/libexport 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib
3. Compile Python 
3.9.1C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizationsmake && 
make install
4. Create a venv and install django and start a demo projectcd /tmp
/home/felix/.local/python/python-3.9.1/bin/python3 -m venv venvsource 
venv/bin/activatepip install djangodjagno-admin startproject democd demo
4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
(venv) [felix@localhost blueprint]$ python manage.py shell
Python 3.9.0 (default, Jan 20 2021, 12:53:25) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>> 

5. Run the demo project (cannot find the new sqlite version ? strange.):(venv) 
[felix@localhost blueprint]$ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
 line 219, in ensure_connection
    self.connect()
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
 line 26, in inner
    return func(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
 line 200, in connect
    self.connection = self.get_new_connection(conn_params)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
 line 26, in inner
    return func(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py",
 line 215, in get_new_connection
    create_deterministic_function('django_date_extract', 2, 
_sqlite_datetime_extract)
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", 
line 950, in _bootstrap_inner
    self.run()
  File "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", 
line 888, in run
    self._target(*self._args, **self._kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/autoreload.py",
 line 53, in wrapper
    fn(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/commands/runserver.py",
 line 121, in inner_run
    self.check_migrations()
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/base.py",
 line 459, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/executor.py",
 line 18, in __init__
    self.loader = MigrationLoader(self.connection)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/loader.py",
 line 53, in __init__
    self.build_graph()
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/loader.py",
 line 216, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File 

Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread panfei
I found that, it may not be a Django-related issue, It's more likely a
Python level issue, but do anyone know how to avoid this problem?:

(venv) [felix@localhost blueprint]$ python
Python 3.9.1 (default, Jan 20 2021, 14:32:50)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> conn = sqlite3.connect(':memory:')
>>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
Traceback (most recent call last):
  File "", line 1, in 
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
higher
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>>


panfei  于2021年1月20日周三 下午8:03写道:

>
> System environment:
>
> Cent OS 7
> Sqlite3 3.34.0 (Compile from source)
> Python 3.9.1 (Compile from source)
> Django 3.1.5 (Pip install)
>
>
> 1. Compile sqlite3:
> ./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0
> make && make install
>
> 2. Add sqlite3 lib to lib search path:
>
> export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/lib
> export LD_RUN_PATH=/home/felix/.local/sqlite/default/lib
>
> 3. Compile Python 3.9.1
> C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
> --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
> make && make install
>
> 4. Create a venv and install django and start a demo project
> cd /tmp
> /home/felix/.local/python/python-3.9.1/bin/python3 -m venv venv
> source venv/bin/activate
> pip install django
> djagno-admin startproject demo
> cd demo
>
> 4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
> (venv) [felix@localhost blueprint]$ python manage.py shell
> Python 3.9.0 (default, Jan 20 2021, 12:53:25)
> [GCC 10.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>> import sqlite3
> >>> sqlite3.sqlite_version
> '3.34.0'
> >>> sqlite3.version
> '2.6.0'
> >>>
>
> 5. Run the demo project (cannot find the new sqlite version ? strange.):
> (venv) [felix@localhost blueprint]$ python manage.py runserver
> Watching for file changes with StatReloader
> Performing system checks...
>
> System check identified no issues (0 silenced).
> Exception in thread django-main-thread:
> Traceback (most recent call last):
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
> line 219, in ensure_connection
> self.connect()
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
> line 26, in inner
> return func(*args, **kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
> line 200, in connect
> self.connection = self.get_new_connection(conn_params)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
> line 26, in inner
> return func(*args, **kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py",
> line 215, in get_new_connection
> create_deterministic_function('django_date_extract', 2,
> _sqlite_datetime_extract)
> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
> higher
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
>   File
> "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", line
> 950, in _bootstrap_inner
> self.run()
>   File
> "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", line
> 888, in run
> self._target(*self._args, **self._kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/autoreload.py",
> line 53, in wrapper
> fn(*args, **kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/commands/runserver.py",
> line 121, in inner_run
> self.check_migrations()
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/base.py",
> line 459, in check_migrations
> executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/executor.py",
> line 18, in __init__
> self.loader = MigrationLoader(self.connection)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/loader.py",
> line 53, in __init__
> self.build_graph()
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/loader.py",
> line 216, in build_graph
> self.applied_migrations = recorder.applied_migrations()
>   File
> 

python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread panfei
System environment:

Cent OS 7
Sqlite3 3.34.0 (Compile from source)
Python 3.9.1 (Compile from source)
Django 3.1.5 (Pip install)


1. Compile sqlite3:
./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0
make && make install

2. Add sqlite3 lib to lib search path:

export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/lib
export LD_RUN_PATH=/home/felix/.local/sqlite/default/lib

3. Compile Python 3.9.1
C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
make && make install

4. Create a venv and install django and start a demo project
cd /tmp
/home/felix/.local/python/python-3.9.1/bin/python3 -m venv venv
source venv/bin/activate
pip install django
djagno-admin startproject demo
cd demo

4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
(venv) [felix@localhost blueprint]$ python manage.py shell
Python 3.9.0 (default, Jan 20 2021, 12:53:25)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>>

5. Run the demo project (cannot find the new sqlite version ? strange.):
(venv) [felix@localhost blueprint]$ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
line 219, in ensure_connection
self.connect()
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
line 26, in inner
return func(*args, **kwargs)
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
line 200, in connect
self.connection = self.get_new_connection(conn_params)
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
line 26, in inner
return func(*args, **kwargs)
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py",
line 215, in get_new_connection
create_deterministic_function('django_date_extract', 2,
_sqlite_datetime_extract)
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
higher

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py",
line 950, in _bootstrap_inner
self.run()
  File "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py",
line 888, in run
self._target(*self._args, **self._kwargs)
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/autoreload.py",
line 53, in wrapper
fn(*args, **kwargs)
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/commands/runserver.py",
line 121, in inner_run
self.check_migrations()
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/base.py",
line 459, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/executor.py",
line 18, in __init__
self.loader = MigrationLoader(self.connection)
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/loader.py",
line 53, in __init__
self.build_graph()
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/loader.py",
line 216, in build_graph
self.applied_migrations = recorder.applied_migrations()
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/recorder.py",
line 77, in applied_migrations
if self.has_table():
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/recorder.py",
line 55, in has_table
with self.connection.cursor() as cursor:
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
line 26, in inner
return func(*args, **kwargs)
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
line 259, in cursor
return self._cursor()
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
line 235, in _cursor
self.ensure_connection()
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
line 26, in 

Query

2021-01-20 Thread Prashant Singh
Is there any java Global Group

-- 
You received this message because you are subscribed to the Google Groups 
"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/CAOQqk5q9X9u%2Bv5LZkFaD7HWiDwhbpqxc%2BRbdy4JGft6Az-04GA%40mail.gmail.com.


Re: To start contribution from initial level

2021-01-20 Thread Carles Pina i Estany


Hi,

On Jan/19/2021, Dhruval Gandhi wrote:
> Hello,
> 
> Myself Dhruval Gandhi, I want to contribute in django .
> But I'm totally new for it.

Welcome to Django

> I want to setup this on my local machine, want to contribute myself via PR,
> But I don't how this all to do it.

There is quite a lot of documentation here:
https://docs.djangoproject.com/en/dev/internals/contributing/

Cheers!

-- 
Carles Pina i Estany
https://carles.pina.cat

-- 
You received this message because you are subscribed to the Google Groups 
"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/20210120091004.GA14193%40pina.cat.