sonagi
@sonagi7840869
Reviews Written
-
Average Rating
-
Posts
Q&A
๋ค๋ฅธ app์์ blog์ post๋ชจ๋ธ์ ๊ฐ์ ธ์ค๋ ค๋ฉด?
์.. ์ ๊ฐ ์ค์๋ฅผ ํ๊ณ ์์๋ค์ ํด๊ฒฐ๋์ต๋๋ค ๊ฐ์ฌํฉ๋๋ค
- 0
- 7
- 1.1K
Q&A
๋ค๋ฅธ app์์ blog์ post๋ชจ๋ธ์ ๊ฐ์ ธ์ค๋ ค๋ฉด?
์๋์ blog ๊ฐ ์๋ ์ํ์์ startapp์ ์ด์ฉํด์ main์ด๋ผ๋ ์ฑ์ ์๋ก ๋ง๋ค์์ต๋๋ค ์ฅ๊ณ ํ๋ก์ ํธ ์ด๋ฆ์ด A๋ผ๊ณ ํ๋ฉด ์ง๊ธ ์ํฉ์ด A blog models.py views.py ๋ฑ๋ฑ.. main models.py views.py ๋ฑ๋ฑ.. A asgi.py settings.py urls.py wsgi.py ์ด๋ฐ์์ผ๋ก blog๋ main์ด ๊ฐ์ ํด๋ ์์ ์์ต๋๋ค
- 0
- 7
- 1.1K
Q&A
๋ค๋ฅธ app์์ blog์ post๋ชจ๋ธ์ ๊ฐ์ ธ์ค๋ ค๋ฉด?
์๋์ ๊ฐ์ ์ค๋ฅ๊ฐ ๋น๋๋ค. --- Traceback (most recent call last): File "views.py", line 2, in from blog.models import Post ModuleNotFoundError: No module named 'blog' ------ ๊ฒฝ๋ก์ง์ ์ด ์๋ชป๋๋์ถ์ด์ from ..blog.models import Post๋ก ๋ฐ๊ฟ์ ํด๋ดค๋๋ฐ ----- Traceback (most recent call last): File "views.py", line 2, in from ..blog.models import Post ImportError: attempted relative import with no known parent package ---- ์ด๋ฒ์ importError๊ฐ ๋์๋ฒ๋ฆฌ๋ค์..ใ ใ ์ฐธ๊ณ ๋ก main/views.py ๋ ์๋์ ๊ฐ์ต๋๋ค.. --- from django.shortcuts import render from ..blog.models import Post def index(request): return render( request, 'main/index.html', ) ---- ์ผ๋จ import๋ก ๋ถ๋ฌ๋ง์ค๊ณ ์ถ์๋ฐ.. ์์๋๋ค์. ์ธํ ์ ๋ฌธ์ ์ผ๊น์? main ํด๋๊ฐ blog์ ํ์ํด๋๋ก ๋ค์ด๊ฐ์ผํ๋๊ฑด์ง..
- 0
- 7
- 1.1K




