[問題] pycharm 無法import同資料夾中的file
如題,pycharm無法import同個資料夾中的file
我的file結構如下:
button
models.py
views.py
views.py 的code內容如最下方所示:
from button.models import buttons <= 而這行持續出現灰色,
highlight顯示pycharm無法import button底下其他的file,
而我也已經把button進行"mark directory as source root", 仍無法成功import
請問有什麼方法可以解決嗎? 謝謝
from django.http import HttpResponse
from django.template import loader
from button.models import buttons
def buttonlist(request):
button_list = buttons.objects.order_by('rack_name')
template = loader.get_template('buttonlist.html')
context = {'button_list':button_list}
for buttons in button_list:
return HttpResponse(template.render(context))
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.221.145.1 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1628230955.A.9EF.html
推
08/06 14:31,
2年前
, 1F
08/06 14:31, 1F
→
08/06 14:31,
2年前
, 2F
08/06 14:31, 2F
→
08/06 14:51,
2年前
, 3F
08/06 14:51, 3F
推
08/06 23:16,
2年前
, 4F
08/06 23:16, 4F
推
08/07 16:39,
2年前
, 5F
08/07 16:39, 5F
→
08/07 16:40,
2年前
, 6F
08/07 16:40, 6F
推
08/07 17:20,
2年前
, 7F
08/07 17:20, 7F
→
08/07 17:21,
2年前
, 8F
08/07 17:21, 8F
→
08/07 17:22,
2年前
, 9F
08/07 17:22, 9F
→
08/07 17:22,
2年前
, 10F
08/07 17:22, 10F