Flask项目设置-本地类库

时间:2018-06-21 16:13:47

标签: python flask

  • 具有所需导入的目录在PYTHONPATH中
  • 我已将打印品放在 init .py的顶部
    导入系统
    打印(sys.path)
    一切都很好-请参见下面的代码第三行

  • 具有所需导入的目录在PYTHONPATH中

  • 我已将打印品放在 init .py的顶部
    导入系统
    打印(sys.path)
    一切都很好

这是文件夹结构:
dgl-home
--dglLib#找不到的类库;具有 init .py
--dgl-env#pipenv venv
--flask-projects
----学习#有问题的项目

这里的控制台: (dgl-env-nWAMFiVe) (xenial)les@localhost:~/dgl-home/dgl-env/flask- projects/learn$ python run.py sys.path ['/home/les/dgl-home/dgl-env/flask-projects/learn', '/home/les/dgl-home/dgl-env/dglLib', '/home/les/.local/share/virtualenvs/dgl-env- nWAMFiVe/lib/python36.zip', '/home/les/.local/share/virtualenvs/dgl- env-nWAMFiVe/lib/python3.6', '/home/les/.local/share/virtualenvs/dgl- env-nWAMFiVe/lib/python3.6/lib-dynload', '/usr/lib/python3.6', '/home/les/.local/share/virtualenvs/dgl-env- nWAMFiVe/lib/python3.6/site-packages'] Traceback (most recent call last): File "run.py", line 1, in from learn import app File "/home/les/dgl-home/dgl-env/flask- projects/learn/learn/init.py", line 8, in from dglLib import ( ModuleNotFoundError: No module named 'dglLib' (dgl-env-nWAMFiVe) (xenial)les@localhost:~/dgl-home/dgl-env/flask- projects/learn$ ls -alt /home/les/dgl-home/dgl-env/dglLib total 72 drwxr-xr-x 7 les root 4096 Jun 20 18:07 .. drwxr-xr-x 3 les les 4096 Jun 20 17:34 . -rw-rw-r-- 1 les les 0 Jun 20 17:34 init.py drwxrwxr-x 8 les les 4096 Jun 20 17:23 .git -rw-rw-r-- 1 les les 4315 Jun 12 19:13 dglPickleToS3BucketClasses.py -rw-rw-r-- 1 les les 10487 Jun 12 19:07 dglContactsClasses.py -rw-rw-r-- 1 les les 3343 Jun 11 17:38 gaicClasses.html -rw-rw-r-- 1 les les 5713 Jun 11 17:32 dglPickleToS3BucketClasses.html -rw-rw-r-- 1 les les 22042 Jun 11 17:23 dglContactsClasses.html -rw-rw-r-- 1 les les 784 Jun 10 00:24 gaicClasses.py

1 个答案:

答案 0 :(得分:0)

找到了-

https://git-scm.com/docs/git-push#git-push---force-

  • 我在PYTHONPATH上放置了完整路径-包括具有defs类的dir-必须备份一个级别