Search code examples
djangopython-3.xpythonanywhere

Static error when giving the command "python manage.py collectstatic"


When I give the command "python manage.py collectstatic" it gives the following problem

"0 static files copied to '/home/leonard368a/leonard368a.pythonanywhere.com/static', 119 unmodified."

does anyone have any way to solve this?

line of command:

STATIC_URL = '/static/'

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static')

]
STATIC_ROOT = "/static/"

Solution

  • Collectstatic command use, when you want to deploy your project on server, command copy all static file on local to server this is main use of this command and it's also be use in local but main perpose is copy all file and put on server file manager,

    In your case you use the STATICFILEES_DIRS and STATIC_ROOT are same so in local file system copy static dir to static that why you need to change STATIC_ROOT='asset' or STATIC_ROOT = os.path.join(BASE_DIR, 'asset') in your root dir

    static file configration in python any where

    collect static in python any where

    If it work let me know