搜尋
首頁後端開發Python教學詳解django中cookiecutter的使用教學課程

python影片教學專欄介紹cookiecutter的使用方法

詳解django中cookiecutter的使用教學課程

#相關免費學習推薦:python影片教學

#一、安裝

匯入:pipenv install cookiecutter

問題:在匯入的過程中可能會報錯:

pkg_resources.VersionConflict: (importlib-metadata 3.1.0 (/Users/apple/.local/share/virtualenvs/testProject-h0hp04R9/lib/python3.6/site-packages), Requirement.parse('importlib-metadata=0.12; python_version

原因及解決:這個問題的出現​​主要是pipenv版本不支持,需要更新pipenv,使用命令:pip3 install -U pipenv,然後重新導入即可。

二、建立專案

執行cookiecutter

問題:直接報錯zsh: command not found: cookiecutter


  • #解決方法:使用pipenv --py取得python環境的安裝目錄,在該目錄下運行cookiecutter
  • 運行之後會繼續報錯:缺少Template
  • Usage: cookiecutter [OPTIONS] TEMPLATE [EXTRA_CONTEXT]...
    Try 'cookiecutter -h' for help.
    Error: Missing argument 'TEMPLATE'.
  • 在github中找到pydanny/cookiecutter- django,賦值github位址,把位址寫在python運行環境的後邊,再次運行
  • /Users/apple/.local/sha~~~~re/virtualenvs/testProject-h0hp04R9/bin/cookiecutter https://github.com/pydanny/cookiecutter-django.git
  • 成功進入設定選項,進行具體的設定
  • 三、具體設定
  • #project_name:項目名稱
  • project_slug:預設和專案的名稱保持一直,不必填入
  • description:專案的簡單描述
  • author_name:作者的名稱,格式名字
  • domain_name:網站網域名稱
  • eamil:信箱
  • version [0.1.0] Select open_source_license: 選擇是否開源類型
  • timezone:時區設置,Asia/Shanghai
  • windows:是否使用的是windows系統開發
  • use_pycharm:是否使用pycharm
  • use_docker:是否使用docker
  • Select postgresql_version:選擇postgresql的版本,預設為最新版,預設沒有繼承Mysql~~~~
  • Select js_task_runner:js的運行器,使用預設的
  • #Select cloud_provider:預設
  • Select mail_service:選擇email的服務
  • use_async:是否使用非同步程式設計
  • use_drf:是否使用django rest_framework,前後端分離的話選擇y
  • custom_bootstrap_compilation:是否自訂bootstrap壓縮
  • use_compressor:用於壓縮js、css的技術,需要選擇y

  • use_celery:是否使用celery,使用選擇y
#use_mailhog:第三方的郵件發送服務


use_sentry:是否使用錯誤日誌監控

##use_whitenoise:用於部署靜態檔案的,帶有檔案壓縮功能

use_heroku:國外有名的pass平台,如果要部署到上邊的話選擇y會自動產生對應的配置

Select ci_tool:選擇工具(None/Travis/Gitlab/Github)

keep_local_envs_in_vcs:是否在本地環境變數中使用版本配置,選擇y

debug:是否使用debug,選擇y

#四、問題:##專案在進行資料遷移的時間可能會報錯:

 File "/Users/apple/.local/share/virtualenvs/django-pro-7n8-wfJY/lib/python3.6/site-packages/django_celery_beat/models.py", line 60, in crontab_schedule_celery_timezone
 choice[0].zone for choice in timezone_field.TimeZoneField.CHOICES
AttributeError: type object 'TimeZoneField' has no attribute 'CHOICES'

原因:django-celery-beat setup.py有一個https://github.com/celery/django-celery-beat/blob/master/requirements/default.txt依賴要求,強制django-timezone-field只能使用>=4.0和###解決方法:pipenv install django-timezone-field==4.0,重新執行資料遷移就可以了######總結######到此這篇關於django中cookiecutter使用教程的文章就介紹到這裡了。 #########想了解更多程式設計學習,請關注###php培訓###欄位! ##########

以上是詳解django中cookiecutter的使用教學課程的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述
本文轉載於:jb51。如有侵權,請聯絡admin@php.cn刪除
Python的科學計算中如何使用陣列?Python的科學計算中如何使用陣列?Apr 25, 2025 am 12:28 AM

Arraysinpython,尤其是Vianumpy,ArecrucialInsCientificComputingfortheireftheireffertheireffertheirefferthe.1)Heasuedfornumerericalicerationalation,dataAnalysis和Machinelearning.2)Numpy'Simpy'Simpy'simplementIncressionSressirestrionsfasteroperoperoperationspasterationspasterationspasterationspasterationspasterationsthanpythonlists.3)inthanypythonlists.3)andAreseNableAblequick

您如何處理同一系統上的不同Python版本?您如何處理同一系統上的不同Python版本?Apr 25, 2025 am 12:24 AM

你可以通過使用pyenv、venv和Anaconda來管理不同的Python版本。 1)使用pyenv管理多個Python版本:安裝pyenv,設置全局和本地版本。 2)使用venv創建虛擬環境以隔離項目依賴。 3)使用Anaconda管理數據科學項目中的Python版本。 4)保留系統Python用於系統級任務。通過這些工具和策略,你可以有效地管理不同版本的Python,確保項目順利運行。

與標準Python陣列相比,使用Numpy數組的一些優點是什麼?與標準Python陣列相比,使用Numpy數組的一些優點是什麼?Apr 25, 2025 am 12:21 AM

numpyarrayshaveseveraladagesoverandastardandpythonarrays:1)基於基於duetoc的iMplation,2)2)他們的aremoremoremorymorymoremorymoremorymoremorymoremoremory,尤其是WithlargedAtasets和3)效率化,效率化,矢量化函數函數函數函數構成和穩定性構成和穩定性的操作,製造

陣列的同質性質如何影響性能?陣列的同質性質如何影響性能?Apr 25, 2025 am 12:13 AM

數組的同質性對性能的影響是雙重的:1)同質性允許編譯器優化內存訪問,提高性能;2)但限制了類型多樣性,可能導致效率低下。總之,選擇合適的數據結構至關重要。

編寫可執行python腳本的最佳實踐是什麼?編寫可執行python腳本的最佳實踐是什麼?Apr 25, 2025 am 12:11 AM

到CraftCraftExecutablePythcripts,lollow TheSebestPractices:1)Addashebangline(#!/usr/usr/bin/envpython3)tomakethescriptexecutable.2)setpermissionswithchmodwithchmod xyour_script.3)

Numpy數組與使用數組模塊創建的數組有何不同?Numpy數組與使用數組模塊創建的數組有何不同?Apr 24, 2025 pm 03:53 PM

numpyArraysareAreBetterFornumericalialoperations andmulti-demensionaldata,而learthearrayModuleSutableforbasic,內存效率段

Numpy數組的使用與使用Python中的數組模塊陣列相比如何?Numpy數組的使用與使用Python中的數組模塊陣列相比如何?Apr 24, 2025 pm 03:49 PM

numpyArraySareAreBetterForHeAvyNumericalComputing,而lelethearRayModulesiutable-usemoblemory-connerage-inderabledsswithSimpleDatateTypes.1)NumpyArsofferVerverVerverVerverVersAtility andPerformanceForlargedForlargedAtatasetSetsAtsAndAtasEndCompleXoper.2)

CTYPES模塊與Python中的數組有何關係?CTYPES模塊與Python中的數組有何關係?Apr 24, 2025 pm 03:45 PM

ctypesallowscreatingingangandmanipulatingc-stylarraysinpython.1)usectypestoInterfacewithClibrariesForperfermance.2)createc-stylec-stylec-stylarraysfornumericalcomputations.3)passarraystocfunctions foreforfunctionsforeffortions.however.however,However,HoweverofiousofmemoryManageManiverage,Pressiveo,Pressivero

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

SecLists

SecLists

SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

SublimeText3 英文版

SublimeText3 英文版

推薦:為Win版本,支援程式碼提示!

Atom編輯器mac版下載

Atom編輯器mac版下載

最受歡迎的的開源編輯器

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境