程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Record a problem encountered in Django project

編輯:Python
  1. invalid python interpreter selected for the project
    1. reason : Not set django Project interpreter
    2. solve : stay setting Just set it in the ( Optional local interpreter , You can also choose conda Environment )
  2. Error: [WinError 10013] Made an attempt to access the socket in a way that the access permission is not allowed
    1. reason : The port is occupied by other processes , Or the last operation did not shut down normally
    2. solve :
      1. Primary solution : Kill the process
        netstat -ano|findstr 8000( View occupancy 8000 Port process id)
        taskkill /pid process id /F ( Kill the process found in the previous step )
      2. Ultimate solution : If this problem persists , Just replace django Default port
  3. You have 18 unapplied migration(s). Your project may not work properly until you apply the migration
    1. solve : Run the specified instruction according to the prompt in the terminal
  4.  CSRF cookie not set. Refer to solve :https://www.jianshu.com/p/671deb51a968
  5. because pycharm and vscode Use different environments , So all outsourcing needs to be downloaded again , Reconfiguration pycharm The use of conda The environment is vscode The environment used in
  6. The framework for running code requires that there must be cuda, but pycharm testing cuda Keep returning false     Or import with error torch Failure
    1. solve : Copy yourself base Configured in the environment cuda Version of torch To pycharm It can be solved in the specified environment .( Remember to delete the original before copying cpu Version of torch)( With torch The first ones are copied to the configured interpreter site-package Next ( Note that all , Otherwise, there will be all kinds of strange mistakes )
  7.  pycharm debug perhaps run A file : Right click directly in the file debug
  8. Generally, it is similar to this kind of next(os.walk(path)) Error when traversing the directory ,stopexception, Generally because path error , modify path that will do
  9. Some of the packages install And import Their names are different
  10. stay pycharm You can't use shortcut directly in :install package... open setting Can be in project Next manual search (+), Looking for bags ,install
  11. Mass substitution remember to use shortcut keys :ctrl+shift+r Replace and pay attention to some spaces and so on
  12. error:django is not importable in this environment:
    1. reason :django Not installed , Or the installed version does not match the virtual environment
    2. solve : have access to pip Install or install in setting Installation in
  13.  venv( A virtual environment ) It can't be deleted , Otherwise, you need to recreate the project
  14. invalid python sdk:
    1. reason : No interpreter selected
    2. solve : Same as the first problem
  15.  ModuleNotFoundError: No module named 'backports', Installed backports After that, it still reported an error
    1. reason : Because this package has many branches , Specific downloads are required
    2. solve : You need to see what is imported from this package , Then actually download backports.xxx
  16.  NameError: name '_C' is not defined : Restarting the compiler is useless
  17.  pycharm Use base Environmental Science , Can't be directly in pycharm Installation package in
    1. solve : After downloading in other environments , Copied to the base Of site-package Next
  18.   Note that the name contains “info” My bag , If it does not have a corresponding paired package , Maybe it just corresponds to a module ( That is, a py file ), You need to copy both
  19. stay pycharm You want to import modules from folders under the same level directory :
    1. Right click on the folder ->mark as-> Set it to source     
    2. If it doesn't work , You can try adding one in front “.”
    3. If it is not possible, you can go directly from package Start import
       

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved