Django / Python / SQlite3

Moderator: cah

Post Reply
cah
General of the Army / Fleet Admiral / General of the Air Force
General of the Army / Fleet Admiral / General of the Air Force
Posts: 1336
Joined: Sun Aug 17, 2008 5:05 am

Django / Python / SQlite3

Post by cah »

Lately, I ran into Django, the web platform to help develop web sites that uses Python as the language.

On my server (Centos 7.8), it has 2 lower version oh Python packages (2.7.5 & 3.6.8). In order to get Django to match the course I am taking, I decided to upgrade to newer version. I found 3.8.6 first and 3.9.6 as the latest available so I chose 3.9.6.

First, I used the following commands to configure and compile Python 3.9: "--enable-shared" is needed to create "libpython3.9.so" for mod_wsgi-4.8.0 (or some other apps) to share the library with PIC (Position Independent Code).

Code: Select all

# LD_RUN_PATH=/usr/local/lib ./configure --enable-optimizations --enable-shared
# D_RUN_PATH=/usr/local/lib make altinstall
It configured, compiled and installed successfully. I then downloaded django vis pip3.9:

Code: Select all

# pip3.9 install django
Then, I tried to create a new project using:

Code: Select all

# django-admin startproject password_generator
It created a new project fine but I ran into error saying it needs SQLite3.8.3 or higher version when I tried to start the server.

I then got SQLite3.36.0 and configured, compiled and installed it but that still didn't work even though the following commands showed correct SQLite version:

Code: Select all

# python3.9
Python 3.9.6 (default, Jul  8 2021, 13:30:17) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.36.0'
I searched around and found people said I need to re-configure, re-compile and re-install using the following commands (2 INCLUDE variables):

Code: Select all

# C_INCLUDE_PATH=/usr/local/include CPLUS_INCLUDE_PATH=/usr/local/include LD_RUN_PATH=/usr/local/lib ./configure --enable-optimizations
# C_INCLUDE_PATH=/usr/local/include CPLUS_INCLUDE_PATH=/usr/local/include LD_RUN_PATH=/usr/local/lib make
# C_INCLUDE_PATH=/usr/local/include CPLUS_INCLUDE_PATH=/usr/local/include LD_RUN_PATH=/usr/local/lib make install
After these commands, I was able to start the django server without errors!

Code: Select all

$ python3.9 manage.py runserver
If I want to change the IP address and port number for django server, I can do:

Code: Select all

$ python3.9 manage.py runserver 1.2.3.4:1234
CAH, The Great
Post Reply