所以我正在运行命令
python manage.py collectstatic
我收到一个错误,我很确定这是因为我的 settings.py 中有一些设置。首先我会附上一张图片,这样每个人都可以看到我的文档树,然后是错误本身。
知道我做错了什么吗?谢谢你。
图片: 带有文件和设置树的图像
我的设置.py
# on the top
import os
# on the bottom
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = os.path.normpath(os.path.join(BASE_DIR, 'staticfiles'))
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
错误如下:
(env) PS C:\Users\lenil\Documents\Development\Personal Projects\the-journey\thejourney_project> python manage.py collectstatic
Traceback (most recent call last):
File "C:\Users\lenil\Documents\Development\Personal Projects\the-journey\thejourney_project\manage.py", line 22, in <module>
main()
File "C:\Users\lenil\Documents\Development\Personal Projects\the-journey\thejourney_project\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\lenil\Documents\Development\Personal Projects\the-journey\thejourney_project\env\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\lenil\Documents\Development\Personal Projects\the-journey\thejourney_project\env\lib\site-packages\django\core\management\__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\lenil\Documents\Development\Personal Projects\the-journey\thejourney_project\env\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\lenil\Documents\Development\Personal Projects\the-journey\thejourney_project\env\lib\site-packages\django\core\management\base.py", line 371, in execute
output = self.handle(*args, **options)
File "C:\Users\lenil\Documents\Development\Personal Projects\the-journey\thejourney_project\env\lib\site-packages\django\contrib\staticfiles\management\commands\collectstatic.py", line 194, in handle
collected = self.collect()
File "C:\Users\lenil\Documents\Development\Personal Projects\the-journey\thejourney_project\env\lib\site-packages\django\contrib\staticfiles\management\commands\collectstatic.py", line 109, in collect
for path, storage in finder.list(self.ignore_patterns):
File "C:\Users\lenil\Documents\Development\Personal Projects\the-journey\thejourney_project\env\lib\site-packages\django\contrib\staticfiles\finders.py", line 130, in list
for path in utils.get_files(storage, ignore_patterns):
File "C:\Users\lenil\Documents\Development\Personal Projects\the-journey\thejourney_project\env\lib\site-packages\django\contrib\staticfiles\utils.py", line 23, in get_files
directories, files = storage.listdir(location)
File "C:\Users\lenil\Documents\Development\Personal Projects\the-journey\thejourney_project\env\lib\site-packages\django\core\files\storage.py", line 316, in listdir
for entry in os.scandir(path):
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\lenil\\Documents\\Development\\Personal Projects\\the-journey\\thejourney_project\\thejourney_project\\static'
(env) PS C:\Users\lenil\Documents\Development\Personal Projects\the-journey\thejourney_project>
非常感谢你的帮助!