Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of error reporting when deploying django project to centos

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge of this article "how to deploy the django project to centos to solve the error report", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to deploy the django project to centos to solve the error report" article.

FAQ1: prompts you to upgrade pip when using pip3 to install libraries

Pip3 install-upgrade pip

FAQ2: when creating a soft link, prompt: ln: failed to create symbolic link'/ usr/bin/python3 ": File exists

We can add a f to the parameter to force the creation

Ln-sf / huyang/python395/bin/python3.9 / usr/bin/python3

FAQ3: when running a django3 project, it doesn't work. It always prompts: DJANGO.CORE.EXCEPTIONS.IMPROPERLYCONFIGURED: SQLITE 3.9.0 OR LATER IS REQUIRED (FOUND 3.7.17).

The default installation of SQLite for centos is version 2.x, but the django requirement is greater than version 3.9.0, so it won't run.

This is a headache, but there are two solutions:

Method one: upgrade the sqlite version of centos. At present, I haven't completely solved this method. Ps: after upgrading the sqlite of centos, the version 2.x is imported from Python3. This question will be left for future study.

Although this method has not been solved, you can first record the sqlite on which centos is installed.

1. Create a folder and go to the folder mkdir-p / usr/local/sqlite & & cd / usr/local/sqlite2. Download sqlitewget wget https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz3. Extract and enter the decompressed folder tar-zxvf sqlite-autoconf-3350500.tar.gz & & cd sqlite-autoconf-33505004. Set the configuration file, install location. / configure-- prefix=/usr/local/sqlite5. Compile and install make & & make install6. Make a backup of the previous sqlite link and create a soft link mv / usr/bin/sqlite3 / usr/bin/sqlite3.bakln-sf / usr/local/sqlite/bin/sqlite3 / usr/bin/sqlite37. Configure the environment variable and take effect export LD_LIBRARY_PATH = "/ usr/local/lib" source ~ /. Bashrc8. Check sqlite version sqlite3-- version

Method 2: replace sqlite with pysqlite. This method is relatively simple. Let's talk about this method.

This method does not depend on the sqlite of the system, but uses pysqlite3 and pysqlite3-binary to operate

1. Install these two libraries first

Pip3 install pysqlite3pip3 install pysqlite3-binary

two。 Modify the base.py file

Vi / huyang/python395/lib/python3.9.5/site-packages/django/db/backends/sqlite3/base.py# from sqlite3 import dbapi2 as Database (comment out this paragraph) from pysqlite3 import dbapi2 as Database # enable pysqlite3

Then press ESC and enter: wqquit to save the exit file

Then you are running the project and you can run it normally.

FAQ4: when installing Python libraries, prompt: ModuleNotFoundError: No module named "_ ctypes"

You need to install libffi-devel, and then recompile and install Python

Yum install libffi-devel-ycd Python-3.9.5make install above is about the content of the article "how to solve the error report when deploying the django project to centos". I believe everyone has a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report