恢复Django 项目

2023-12-15 09:39:51

随笔记录

目录

1. 重建Mysql DB

2. 启动Django 项目

2.1 确保你的系统上已安装pip工具。你可以使用以下命令来检查pip是否已安装

2.2? 安装Packages

2.2.1 安装Django

2.2.2 安装pymysql

2.2.3?安装 kafka

2.2.4?安装 requests

2.2.5 安装simplepro

2.2.6 安装libjpeg-devel

2.2.7?重新安装simplepro

2.2.8 安装faker?

2.3?所有packages安装完成后,再次运行你的Python脚本

2.4?启动Django 项目

2.5?浏览器访问

3. 添加supervisord 守护进程


1. 重建Mysql DB

2. 启动Django 项目


[root@localhost Init_Sys]# pwd
/home/TestEvn/Risk_Init_V2/Init_Sys
[root@localhost Init_Sys]# 
[root@localhost Init_Sys]# 
[root@localhost Init_Sys]# ll
total 844
drwxr-xr-x. 9 root root    272 Apr 21  2023 Initapp
-rw-r--r--. 1 root root 853282 Apr 21  2023 Initapp.zip
drwxr-xr-x. 3 root root    136 Apr 21  2023 Init_Sys
-rw-r--r--. 1 root root   1022 Apr 21  2023 manage.py
-rw-r--r--. 1 root root    276 Apr 21  2023 Start_Init.sh
[root@localhost Init_Sys]# 
[root@localhost Init_Sys]# python3 manage.py makemigrations Initapp
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    from django.core.management.commands.runserver import Command as Runserver
ModuleNotFoundError: No module named 'django'
[root@localhost Init_Sys]# 

2.1 确保你的系统上已安装pip工具。你可以使用以下命令来检查pip是否已安装
# 没有Django package, 安装Django

[root@localhost Init_Sys]# 
[root@localhost Init_Sys]# 
[root@localhost Init_Sys]# pip3 --version
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
[root@localhost Init_Sys]# 
[root@localhost Init_Sys]# 

2.2? 安装Packages
2.2.1 安装Django
# 如果你想安装特定版本的Django,请将上述命令中的"django"替换为所需版本的Django

[root@localhost Init_Sys]# 
[root@localhost Init_Sys]# pip3 install django
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting django
  Downloading https://files.pythonhosted.org/packages/c9/69/72663af69f1a70fa186813220c8ec5ce7f9056b6d987077e2c38ed794bee/Django-3.2.23-py3-none-any.whl (7.9MB)
    100% |████████████████████████████████| 7.9MB 26kB/s 
Collecting asgiref<4,>=3.3.2 (from django)
  Downloading https://files.pythonhosted.org/packages/fe/66/577f32b54c50dcd8dec38447258e82ed327ecb86820d67ae7b3dea784f13/asgiref-3.4.1-py3-none-any.whl
Collecting pytz (from django)
  Downloading https://files.pythonhosted.org/packages/32/4d/aaf7eff5deb402fd9a24a1449a8119f00d74ae9c2efa79f8ef9994261fc2/pytz-2023.3.post1-py2.py3-none-any.whl (502kB)
    100% |████████████████████████████████| 512kB 30kB/s 
Collecting sqlparse>=0.2.2 (from django)
  Downloading https://files.pythonhosted.org/packages/98/5a/66d7c9305baa9f11857f247d4ba761402cea75db6058ff850ed7128957b7/sqlparse-0.4.4-py3-none-any.whl (41kB)
    100% |████████████████████████████████| 51kB 24kB/s 
Collecting typing-extensions; python_version < "3.8" (from asgiref<4,>=3.3.2->django)
  Downloading https://files.pythonhosted.org/packages/45/6b/44f7f8f1e110027cf88956b59f2fad776cca7e1704396d043f89effd3a0e/typing_extensions-4.1.1-py3-none-any.whl
Installing collected packages: typing-extensions, asgiref, pytz, sqlparse, django
Successfully installed asgiref-3.4.1 django-3.2.23 pytz-2023.3.post1 sqlparse-0.4.4 typing-extensions-4.1.1
[root@localhost Init_Sys]# 
2.2.2 安装pymysql
[root@localhost Init_Sys]# pip3 install pymysql
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting pymysql
  Downloading https://files.pythonhosted.org/packages/4f/52/a115fe175028b058df353c5a3d5290b71514a83f67078a6482cff24d6137/PyMySQL-1.0.2-py3-none-any.whl (43kB)
    100% |████████████████████████████████| 51kB 268kB/s 
Installing collected packages: pymysql
Successfully installed pymysql-1.0.2
[root@localhost Init_Sys]# 
2.2.3?安装 kafka
[root@localhost Init_Sys]# pip3 install kafka-python
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting kafka-python
  Downloading https://files.pythonhosted.org/packages/75/68/dcb0db055309f680ab2931a3eeb22d865604b638acf8c914bedf4c1a0c8c/kafka_python-2.0.2-py2.py3-none-any.whl (246kB)
    100% |████████████████████████████████| 256kB 1.0MB/s 
Installing collected packages: kafka-python
Successfully installed kafka-python-2.0.2
[root@localhost Init_Sys]# 
[root@localhost Init_Sys]# 
2.2.4?安装 requests
[root@localhost Init_Sys]# 
[root@localhost Init_Sys]# pip3 install requests
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting requests
  Downloading https://files.pythonhosted.org/packages/2d/61/08076519c80041bc0ffa1a8af0cbd3bf3e2b62af10435d269a9d0f40564d/requests-2.27.1-py2.py3-none-any.whl (63kB)
    100% |████████████████████████████████| 71kB 312kB/s 
Collecting urllib3<1.27,>=1.21.1 (from requests)
  Downloading https://files.pythonhosted.org/packages/b0/53/aa91e163dcfd1e5b82d8a890ecf13314e3e149c05270cc644581f77f17fd/urllib3-1.26.18-py2.py3-none-any.whl (143kB)
    100% |████████████████████████████████| 153kB 571kB/s 
Collecting certifi>=2017.4.17 (from requests)
  Downloading https://files.pythonhosted.org/packages/64/62/428ef076be88fa93716b576e4a01f919d25968913e817077a386fcbe4f42/certifi-2023.11.17-py3-none-any.whl (162kB)
    100% |████████████████████████████████| 163kB 1.6MB/s 
Collecting charset-normalizer~=2.0.0; python_version >= "3" (from requests)
  Downloading https://files.pythonhosted.org/packages/06/b3/24afc8868eba069a7f03650ac750a778862dc34941a4bebeb58706715726/charset_normalizer-2.0.12-py3-none-any.whl
Collecting idna<4,>=2.5; python_version >= "3" (from requests)
  Downloading https://files.pythonhosted.org/packages/c2/e7/a82b05cf63a603df6e68d59ae6a68bf5064484a0718ea5033660af4b54a9/idna-3.6-py3-none-any.whl (61kB)
    100% |████████████████████████████████| 71kB 2.3MB/s 
Installing collected packages: urllib3, certifi, charset-normalizer, idna, requests
Successfully installed certifi-2023.11.17 charset-normalizer-2.0.12 idna-3.6 requests-2.27.1 urllib3-1.26.18
[root@localhost Init_Sys]# 
2.2.5 安装simplepro
[root@localhost Init_Sys]# pip3 install simplepro
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting simplepro
  Using cached https://files.pythonhosted.org/packages/b5/a2/7d4fc4d98ff39d5453f4f5c7be8c07c593e6f863e0accdefa88f56916622/simplepro-7.2.2.tar.gz
Requirement already satisfied: django>=2.1 in /usr/local/lib64/python3.6/site-packages (from simplepro)
Requirement already satisfied: django-simpleui>=2023.11.15 in /usr/local/lib/python3.6/site-packages (from simplepro)
Requirement already satisfied: django-import-export in /usr/local/lib/python3.6/site-packages (from simplepro)
Requirement already satisfied: requests in /usr/local/lib/python3.6/site-packages (from simplepro)
Requirement already satisfied: rsa in /usr/local/lib/python3.6/site-packages (from simplepro)
Requirement already satisfied: psutil in /usr/local/lib64/python3.6/site-packages (from simplepro)
Collecting pillow (from simplepro)
  Using cached https://files.pythonhosted.org/packages/7d/2a/2fc11b54e2742db06297f7fa7f420a0e3069fdcf0e4b57dfec33f0b08622/Pillow-8.4.0.tar.gz
Requirement already satisfied: sqlparse>=0.2.2 in /usr/local/lib/python3.6/site-packages (from django>=2.1->simplepro)
Requirement already satisfied: pytz in /usr/local/lib/python3.6/site-packages (from django>=2.1->simplepro)
Requirement already satisfied: asgiref<4,>=3.3.2 in /usr/local/lib/python3.6/site-packages (from django>=2.1->simplepro)
Requirement already satisfied: diff-match-patch in /usr/local/lib/python3.6/site-packages (from django-import-export->simplepro)
Requirement already satisfied: tablib[html,ods,xls,xlsx,yaml]>=3.0.0 in /usr/local/lib/python3.6/site-packages (from django-import-export->simplepro)
Requirement already satisfied: idna<4,>=2.5; python_version >= "3" in /usr/local/lib/python3.6/site-packages (from requests->simplepro)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests->simplepro)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests->simplepro)
Requirement already satisfied: charset-normalizer~=2.0.0; python_version >= "3" in /usr/local/lib/python3.6/site-packages (from requests->simplepro)
Requirement already satisfied: pyasn1>=0.1.3 in /usr/local/lib/python3.6/site-packages (from rsa->simplepro)
Requirement already satisfied: typing-extensions; python_version < "3.8" in /usr/local/lib/python3.6/site-packages (from asgiref<4,>=3.3.2->django>=2.1->simplepro)
Requirement already satisfied: markuppy; extra == "html" in /usr/local/lib/python3.6/site-packages (from tablib[html,ods,xls,xlsx,yaml]>=3.0.0->django-import-export->simplepro)
Requirement already satisfied: odfpy; extra == "ods" in /usr/local/lib/python3.6/site-packages (from tablib[html,ods,xls,xlsx,yaml]>=3.0.0->django-import-export->simplepro)
Requirement already satisfied: xlrd; extra == "xls" in /usr/local/lib/python3.6/site-packages (from tablib[html,ods,xls,xlsx,yaml]>=3.0.0->django-import-export->simplepro)
Requirement already satisfied: xlwt; extra == "xls" in /usr/local/lib/python3.6/site-packages (from tablib[html,ods,xls,xlsx,yaml]>=3.0.0->django-import-export->simplepro)
Requirement already satisfied: openpyxl>=2.6.0; extra == "xlsx" in /usr/local/lib/python3.6/site-packages (from tablib[html,ods,xls,xlsx,yaml]>=3.0.0->django-import-export->simplepro)
Requirement already satisfied: pyyaml; extra == "yaml" in /usr/local/lib64/python3.6/site-packages (from tablib[html,ods,xls,xlsx,yaml]>=3.0.0->django-import-export->simplepro)
Requirement already satisfied: defusedxml in /usr/local/lib/python3.6/site-packages (from odfpy; extra == "ods"->tablib[html,ods,xls,xlsx,yaml]>=3.0.0->django-import-export->simplepro)
Requirement already satisfied: et-xmlfile in /usr/local/lib/python3.6/site-packages (from openpyxl>=2.6.0; extra == "xlsx"->tablib[html,ods,xls,xlsx,yaml]>=3.0.0->django-import-export->simplepro)
Installing collected packages: pillow, simplepro
  Running setup.py install for pillow ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-d51wvxqq/pillow/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-og1tmj5x-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/BdfFontFile.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/BlpImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/BmpImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/BufrStubImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ContainerIO.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/CurImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/DcxImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/DdsImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/EpsImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ExifTags.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/FitsStubImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/FliImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/FontFile.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/FpxImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/FtexImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/GbrImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/GdImageFile.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/GifImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/GimpGradientFile.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/GimpPaletteFile.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/GribStubImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/Hdf5StubImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/IcnsImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/IcoImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/Image.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageChops.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageCms.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageColor.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageDraw.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageDraw2.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageEnhance.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageFile.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageFilter.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageFont.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageGrab.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageMath.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageMode.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageMorph.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageOps.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImagePalette.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImagePath.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageQt.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageSequence.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageShow.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageStat.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageTk.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageTransform.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImageWin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/ImtImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/IptcImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/Jpeg2KImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/JpegImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/JpegPresets.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/McIdasImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/MicImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/MpegImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/MpoImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/MspImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/PSDraw.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/PaletteFile.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/PalmImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/PcdImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/PcfFontFile.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/PcxImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/PdfImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/PdfParser.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/PixarImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/PngImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/PpmImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/PsdImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/PyAccess.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/SgiImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/SpiderImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/SunImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/TarIO.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/TgaImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/TiffImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/TiffTags.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/WalImageFile.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/WebPImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/WmfImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/XVThumbImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/XbmImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/XpmImagePlugin.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/__init__.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/__main__.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/_binary.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/_tkinter_finder.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/_util.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/_version.py -> build/lib.linux-x86_64-3.6/PIL
    copying src/PIL/features.py -> build/lib.linux-x86_64-3.6/PIL
    running egg_info
    writing src/Pillow.egg-info/PKG-INFO
    writing dependency_links to src/Pillow.egg-info/dependency_links.txt
    writing top-level names to src/Pillow.egg-info/top_level.txt
    reading manifest file 'src/Pillow.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no files found matching '*.c'
    warning: no files found matching '*.h'
    warning: no files found matching '*.sh'
    warning: no previously-included files found matching '.appveyor.yml'
    warning: no previously-included files found matching '.clang-format'
    warning: no previously-included files found matching '.coveragerc'
    warning: no previously-included files found matching '.editorconfig'
    warning: no previously-included files found matching '.readthedocs.yml'
    warning: no previously-included files found matching 'codecov.yml'
    warning: no previously-included files matching '.git*' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
    no previously-included directories found matching '.ci'
    writing manifest file 'src/Pillow.egg-info/SOURCES.txt'
    running build_ext
    
    
    The headers or library files could not be found for jpeg,
    a required dependency when compiling Pillow from source.
    
    Please see the install instructions at:
       https://pillow.readthedocs.io/en/latest/installation.html
    
    Traceback (most recent call last):
      File "/tmp/pip-build-d51wvxqq/pillow/setup.py", line 1024, in <module>
        zip_safe=not (debug_build() or PLATFORM_MINGW),
      File "/usr/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib64/python3.6/distutils/command/install.py", line 556, in run
        self.run_command('build')
      File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib64/python3.6/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 78, in run
        _build_ext.run(self)
      File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 339, in run
        self.build_extensions()
      File "/tmp/pip-build-d51wvxqq/pillow/setup.py", line 790, in build_extensions
        raise RequiredDependencyException(f)
    __main__.RequiredDependencyException: jpeg
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-d51wvxqq/pillow/setup.py", line 1037, in <module>
        raise RequiredDependencyException(msg)
    __main__.RequiredDependencyException:
    
    The headers or library files could not be found for jpeg,
    a required dependency when compiling Pillow from source.
    
    Please see the install instructions at:
       https://pillow.readthedocs.io/en/latest/installation.html
    
    
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-d51wvxqq/pillow/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-og1tmj5x-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-d51wvxqq/pillow/
[root@localhost Init_Sys]# 


# 安装simplePro 失败,根据错误信息显示,安装Pillow库时出现了一个错误。错误提示说找不到jpeg的头文件或库文件,这是在从源码编译Pillow时所需的一个依赖项。

# sudo yum install libjpeg-devel
2.2.6 安装libjpeg-devel
[root@localhost Init_Sys]# yum install libjpeg-devel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.bfsu.edu.cn
 * epel: mirrors.bfsu.edu.cn
 * extras: mirrors.bfsu.edu.cn
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package libjpeg-turbo-devel.x86_64 0:1.2.90-8.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================================================================================================
 Package                                                                       Arch                                                             Version                                                                Repository                                                      Size
============================================================================================================================================================================================================================================================================================
Installing:
 libjpeg-turbo-devel                                                           x86_64                                                           1.2.90-8.el7                                                           base                                                            99 k

Transaction Summary
============================================================================================================================================================================================================================================================================================
Install  1 Package

Total download size: 99 k
Installed size: 314 k
Is this ok [y/d/N]: y                          # y
Downloading packages:
libjpeg-turbo-devel-1.2.90-8.el7.x86_64.rpm                                                                                                                                                                                                                          |  99 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libjpeg-turbo-devel-1.2.90-8.el7.x86_64                                                                                                                                                                                                                                  1/1 
  Verifying  : libjpeg-turbo-devel-1.2.90-8.el7.x86_64                                                                                                                                                                                                                                  1/1 

Installed:
  libjpeg-turbo-devel.x86_64 0:1.2.90-8.el7                                                                                                                                                                                                                                                 

Complete!
[root@localhost Init_Sys]# 
[root@localhost Init_Sys]# 
2.2.7?重新安装simplepro
# 重新安装  simplepro

[root@localhost Init_Sys]# pip3 install simplepro
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting simplepro
  Using cached https://files.pythonhosted.org/packages/b5/a2/7d4fc4d98ff39d5453f4f5c7be8c07c593e6f863e0accdefa88f56916622/simplepro-7.2.2.tar.gz
Requirement already satisfied: django>=2.1 in /usr/local/lib64/python3.6/site-packages (from simplepro)
Requirement already satisfied: django-simpleui>=2023.11.15 in /usr/local/lib/python3.6/site-packages (from simplepro)
Requirement already satisfied: django-import-export in /usr/local/lib/python3.6/site-packages (from simplepro)
Requirement already satisfied: requests in /usr/local/lib/python3.6/site-packages (from simplepro)
Requirement already satisfied: rsa in /usr/local/lib/python3.6/site-packages (from simplepro)
Requirement already satisfied: psutil in /usr/local/lib64/python3.6/site-packages (from simplepro)
Collecting pillow (from simplepro)
  Using cached https://files.pythonhosted.org/packages/7d/2a/2fc11b54e2742db06297f7fa7f420a0e3069fdcf0e4b57dfec33f0b08622/Pillow-8.4.0.tar.gz
Requirement already satisfied: pytz in /usr/local/lib/python3.6/site-packages (from django>=2.1->simplepro)
Requirement already satisfied: asgiref<4,>=3.3.2 in /usr/local/lib/python3.6/site-packages (from django>=2.1->simplepro)
Requirement already satisfied: sqlparse>=0.2.2 in /usr/local/lib/python3.6/site-packages (from django>=2.1->simplepro)
Requirement already satisfied: tablib[html,ods,xls,xlsx,yaml]>=3.0.0 in /usr/local/lib/python3.6/site-packages (from django-import-export->simplepro)
Requirement already satisfied: diff-match-patch in /usr/local/lib/python3.6/site-packages (from django-import-export->simplepro)
Requirement already satisfied: charset-normalizer~=2.0.0; python_version >= "3" in /usr/local/lib/python3.6/site-packages (from requests->simplepro)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests->simplepro)
Requirement already satisfied: idna<4,>=2.5; python_version >= "3" in /usr/local/lib/python3.6/site-packages (from requests->simplepro)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests->simplepro)
Requirement already satisfied: pyasn1>=0.1.3 in /usr/local/lib/python3.6/site-packages (from rsa->simplepro)
Requirement already satisfied: typing-extensions; python_version < "3.8" in /usr/local/lib/python3.6/site-packages (from asgiref<4,>=3.3.2->django>=2.1->simplepro)
Requirement already satisfied: markuppy; extra == "html" in /usr/local/lib/python3.6/site-packages (from tablib[html,ods,xls,xlsx,yaml]>=3.0.0->django-import-export->simplepro)
Requirement already satisfied: odfpy; extra == "ods" in /usr/local/lib/python3.6/site-packages (from tablib[html,ods,xls,xlsx,yaml]>=3.0.0->django-import-export->simplepro)
Requirement already satisfied: xlrd; extra == "xls" in /usr/local/lib/python3.6/site-packages (from tablib[html,ods,xls,xlsx,yaml]>=3.0.0->django-import-export->simplepro)
Requirement already satisfied: xlwt; extra == "xls" in /usr/local/lib/python3.6/site-packages (from tablib[html,ods,xls,xlsx,yaml]>=3.0.0->django-import-export->simplepro)
Requirement already satisfied: openpyxl>=2.6.0; extra == "xlsx" in /usr/local/lib/python3.6/site-packages (from tablib[html,ods,xls,xlsx,yaml]>=3.0.0->django-import-export->simplepro)
Requirement already satisfied: pyyaml; extra == "yaml" in /usr/local/lib64/python3.6/site-packages (from tablib[html,ods,xls,xlsx,yaml]>=3.0.0->django-import-export->simplepro)
Requirement already satisfied: defusedxml in /usr/local/lib/python3.6/site-packages (from odfpy; extra == "ods"->tablib[html,ods,xls,xlsx,yaml]>=3.0.0->django-import-export->simplepro)
Requirement already satisfied: et-xmlfile in /usr/local/lib/python3.6/site-packages (from openpyxl>=2.6.0; extra == "xlsx"->tablib[html,ods,xls,xlsx,yaml]>=3.0.0->django-import-export->simplepro)
Installing collected packages: pillow, simplepro
  Running setup.py install for pillow ... done
  Running setup.py install for simplepro ... done
Successfully installed pillow-8.4.0 simplepro-7.2.2
[root@localhost Init_Sys]# 
2.2.8 安装faker?
root@localhost Init_Sys]# pip3 install faker
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting faker
  Downloading https://files.pythonhosted.org/packages/36/e9/eb926239c310abc1502caffe651ac83e72a11c4cc9b9f8d9294be942758b/Faker-14.2.1-py3-none-any.whl (1.6MB)
    100% |████████████████████████████████| 1.6MB 31kB/s 
Collecting python-dateutil>=2.4 (from faker)
  Downloading https://files.pythonhosted.org/packages/36/7a/87837f39d0296e723bb9b62bbb257d0355c7f6128853c78955f57342a56d/python_dateutil-2.8.2-py2.py3-none-any.whl (247kB)
    100% |████████████████████████████████| 256kB 18kB/s 
Requirement already satisfied: typing-extensions>=3.7.4.3; python_version < "3.8" in /usr/local/lib/python3.6/site-packages (from faker)
Collecting six>=1.5 (from python-dateutil>=2.4->faker)
  Downloading https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
Installing collected packages: six, python-dateutil, faker
Successfully installed faker-14.2.1 python-dateutil-2.8.2 six-1.16.0
[root@localhost Init_Sys]# 
2.3?所有packages安装完成后,再次运行你的Python脚本
# python3 manage.py makemigrations Initapp

[root@localhost Init_Sys]# python3 manage.py makemigrations Initapp
Migrations for 'Initapp':
  Initapp/migrations/0097_alter_dyn_rule_factor_param_config_risk_param_type.py
    - Alter field risk_param_type on dyn_rule_factor_param_config
[root@localhost Init_Sys]# 
[root@localhost Init_Sys]# 
[root@localhost Init_Sys]# 
[root@localhost Init_Sys]# python3 manage.py migrate Initapp
Operations to perform:
  Apply all migrations: Initapp
Running migrations:
  Applying Initapp.0001_initial... OK
  Applying Initapp.0002_auto_20220903_1417... OK
  Applying Initapp.0003_auto_20220904_1658... OK
  Applying Initapp.0004_index_componentinfo_ext_stock_production_ext... OK
  Applying Initapp.0005_auto_20221011_1418... OK
  Applying Initapp.0006_auto_20221012_0952... OK
  Applying Initapp.0007_auto_20221012_0953... OK
  Applying Initapp.0008_auto_20221012_0953... OK
  Applying Initapp.0009_auto_20221012_0954... OK
  Applying Initapp.0010_auto_20221012_0956... OK
  Applying Initapp.0011_auto_20221012_1002... OK
  Applying Initapp.0012_alter_rule_acc_except_control_level_value... OK
  Applying Initapp.0013_auto_20221013_1429... OK
  Applying Initapp.0014_alter_security_info_security_type... OK
  Applying Initapp.0015_auto_20221013_1648... OK
  Applying Initapp.0016_alter_stock_production_ext_securityname... OK
  Applying Initapp.0017_auto_20221013_1653... OK
  Applying Initapp.0018_auto_20221013_1709... OK
  Applying Initapp.0019_auto_20221013_1715... OK
  Applying Initapp.0020_alter_stock_production_ext_contractmultipli... OK
  Applying Initapp.0021_auto_20221013_1720... OK
  Applying Initapp.0022_alter_security_info_security_type... OK
  Applying Initapp.0023_alter_security_info_security_type... OK
  Applying Initapp.0024_alter_rule_info_risk_conno... OK
  Applying Initapp.0025_alter_rule_info_risk_conno... OK
  Applying Initapp.0026_auto_20221017_1059... OK
  Applying Initapp.0027_auto_20221017_1100... OK
  Applying Initapp.0028_alter_rule_account_config_control_level... OK
  Applying Initapp.0029_alter_rule_info_enable_status... OK
  Applying Initapp.0030_auto_20221017_1619... OK
  Applying Initapp.0031_alter_security_info_securityid... OK
  Applying Initapp.0032_alter_security_info_securityid... OK
  Applying Initapp.0033_alter_security_info_securityid... OK
  Applying Initapp.0034_auto_20221017_1737... OK
  Applying Initapp.0035_alter_rule_account_config_account_source... OK
  Applying Initapp.0036_alter_rule_account_config_account_source... OK
  Applying Initapp.0037_alter_security_info_security_exchange... OK
  Applying Initapp.0038_alter_rule_condition_config_risk_param_type... OK
  Applying Initapp.0039_alter_security_info_securityid... OK
  Applying Initapp.0040_auto_20221018_1408... OK
  Applying Initapp.0041_auto_20221018_1454... OK
  Applying Initapp.0042_alter_rule_condition_config_factor_int_para3... OK
  Applying Initapp.0043_auto_20221018_1611... OK
  Applying Initapp.0044_alter_rule_condition_config_risk_param_type... OK
  Applying Initapp.0045_alter_security_info_securityid... OK
  Applying Initapp.0046_auto_20221025_1032... OK
  Applying Initapp.0047_auto_20221025_1037... OK
  Applying Initapp.0048_auto_20221025_1719... OK
  Applying Initapp.0049_auto_20221026_1609... OK
  Applying Initapp.0050_alter_threshold_value_a_pchg1... OK
  Applying Initapp.0051_alter_security_info_securityid... OK
  Applying Initapp.0052_auto_20221027_1139... OK
  Applying Initapp.0053_auto_20221027_1302... OK
  Applying Initapp.0054_auto_20221027_1307... OK
  Applying Initapp.0055_auto_20221027_1321... OK
  Applying Initapp.0056_alter_rule_info_remakrks... OK
  Applying Initapp.0057_auto_20221027_1343... OK
  Applying Initapp.0058_auto_20221027_1538... OK
  Applying Initapp.0059_auto_20221027_1700... OK
  Applying Initapp.0060_alter_rule_account_config_account_source... OK
  Applying Initapp.0061_auto_20221028_1605... OK
  Applying Initapp.0062_alter_rule_info_risk_conno... OK
  Applying Initapp.0063_alter_rule_info_riskcon_begindate... OK
  Applying Initapp.0064_alter_rule_info_riskcon_begindate... OK
  Applying Initapp.0065_auto_20221031_1107... OK
  Applying Initapp.0066_alter_index_componentinfo_ext_componentsecurityexchange... OK
  Applying Initapp.0067_alter_index_componentinfo_ext_componentsecurityexchange... OK
  Applying Initapp.0068_alter_index_componentinfo_ext_securityid... OK
  Applying Initapp.0069_alter_index_componentinfo_ext_securityid... OK
  Applying Initapp.0070_auto_20221031_1355... OK
  Applying Initapp.0071_auto_20221101_1040... OK
  Applying Initapp.0072_alter_account_info_stock_holder_no... OK
  Applying Initapp.0073_auto_20221104_0020... OK
  Applying Initapp.0074_alter_rule_account_config_account_source... OK
  Applying Initapp.0075_auto_20221114_1438... OK
  Applying Initapp.0076_alter_stock_production_ext_securityid... OK
  Applying Initapp.0077_auto_20221114_1450... OK
  Applying Initapp.0078_dynamic_dimension... OK
  Applying Initapp.0079_stock_production_ext_closepx... OK
  Applying Initapp.0080_auto_20221121_1103... OK
  Applying Initapp.0081_alter_dynamic_dimension_dimensionid... OK
  Applying Initapp.0082_auto_20221122_1401... OK
  Applying Initapp.0083_alter_rule_account_config_account_source... OK
  Applying Initapp.0084_dyn_rule_info... OK
  Applying Initapp.0085_alter_dyn_rule_info_risk_conno... OK
  Applying Initapp.0086_alter_dyn_rule_info_risk_conno... OK
  Applying Initapp.0087_auto_20230323_0953... OK
  Applying Initapp.0088_auto_20230323_1123... OK
  Applying Initapp.0089_dyn_rule_acc_except_dyn_rule_account_config_dyn_rule_condition_config_dyn_rule_factor_config_dyn_rul... OK
  Applying Initapp.0090_alter_dyn_rule_info_risk_conno... OK
  Applying Initapp.0091_alter_dyn_rule_factor_param_config_remove_sec_value... OK
  Applying Initapp.0092_alter_dyn_rule_factor_param_config_remove_sec_value... OK
  Applying Initapp.0093_auto_20230328_0927... OK
  Applying Initapp.0094_auto_20230328_0930... OK
  Applying Initapp.0095_auto_20230328_0934... OK
  Applying Initapp.0096_alter_rule_account_config_enable_status... OK
  Applying Initapp.0097_alter_dyn_rule_factor_param_config_risk_param_type... OK
[root@localhost Init_Sys]# 
2.4?启动Django 项目
[root@localhost Init_Sys]# python3 manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).

You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
December 11, 2023 - 10:05:35
Django version 3.2.23, using settings 'Init_Sys.settings'
Starting development server at http://192.168.2.247:8888/
Quit the server with CONTROL-C.
2.5?浏览器访问

3. 添加supervisord 守护进程

文章来源:https://blog.csdn.net/weixin_57632548/article/details/134931034
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。