django中多個app放入同一檔案夾apps

來源:互聯網
上載者:User

標籤:span   col   pychar   添加   tap   dash   pyc   ash   djang   

開發環境:pycharm
  • 建立一個apps檔案夾
  • 需要整理的app檔案夾拖到同一個檔案夾中,即apps。(彈出對話方塊,取消勾選Search for references)
  • 在pycharm 中,右鍵apps檔案夾-–選擇mark directory as—-選擇sources root。
  • 工程的setting.py代碼中添加
    sys.path.insert(0,os.path.join(BASE_DIR,‘apps‘))

     

以上,就可以正常使用了。

 

這裡加上個方法,如果需要在指定目錄下產生app。可以使用

django-admin startapp name [directory]

這種方式需要提前建立一個檔案夾,比如我打算在apps下產生一個demo的app

  1. 在apps下建立一個demo檔案夾
  2. 使用 startapp demo apps/demo 將app產生到apps/demo/檔案夾中

以上。

django中多個app放入同一檔案夾apps

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.