Forums

Uploading my Git. collectstatic error

When I am calling pa_autoconfigure_django.py https://github.com/khizirsiddiqui/gammaLearning.git from the bash console, it is giving error when running collectstatic. Error:

subprocess.CalledProcessError: Command

'[PosixPath('/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/bin/python'), PosixPath('/home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/manage.py'), 'collectstatic', '--noinput']' returned non-zero exit status 1.

Please help me getting the site up. Thanks in adv. :)

Could you give the full error trace that it printed out? There should be some indication of why that process exited with an error code in there.

.

Traceback (most recent call last):
      File "/home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/manage.py", line 15, in <module>
        execute_from_command_line(sys.argv)
      File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
        utility.execute()
      File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/core/management/__init__.py", line 36
    5, in execute
        self.fetch_command(subcommand).run_from_argv(self.argv)
      File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/core/management/base.py", line 288, i
    n run_from_argv
        self.execute(*args, **cmd_options)
      File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/core/management/base.py", line 335, i
    n execute
        output = self.handle(*args, **options)
      File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/contrib/staticfiles/management/comman
    ds/collectstatic.py", line 189, in handle
        collected = self.collect()
      File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/contrib/staticfiles/management/comman
    ds/collectstatic.py", line 105, in collect
        for path, storage in finder.list(self.ignore_patterns):
      File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/contrib/staticfiles/finders.py", line
     125, in list
        for path in utils.get_files(storage, ignore_patterns):
      File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/contrib/staticfiles/utils.py", line 2
    8, in get_files
        directories, files = storage.listdir(location)
      File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/core/files/storage.py", line 313, in 
    listdir
        for entry in os.listdir(path):
    FileNotFoundError: [Errno 2] No such file or directory: '/home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/static'
    Traceback (most recent call last):
      File "/home/khizirsiddiqui/.local/bin/pa_autoconfigure_django.py", line 56, in <module>
        main(arguments['<git-repo-url>'], arguments['--domain'], arguments['--python'], nuke=arguments.get('--nuke'))
      File "/home/khizirsiddiqui/.local/bin/pa_autoconfigure_django.py", line 42, in main
        project.run_collectstatic()
      File "/home/khizirsiddiqui/.local/lib/python3.6/site-packages/pythonanywhere/django_project.py", line 87, in run_collectstatic
        '--noinput',
      File "/usr/lib/python3.6/subprocess.py", line 291, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '[PosixPath('/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/bin/python'), PosixPath('/ho
    me/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/manage.py'), 'collectstatic', '--noinput']' returned non-zero exit status 1.

[edit by admin: formatting]

Is anything printed out before all of that? There should be a more detailed indication of how it failed.

::python

  07:05 ~ $ pip3.6 install --user pythonanywhere
            Requirement already satisfied: pythonanywhere in ./.local/lib/python3.6/site-packages
            Requirement already satisfied: requests in /usr/local/lib/python3.6/dist-packages (from pythonanywhere)
            Requirement already satisfied: docopt in /usr/local/lib/python3.6/dist-packages (from pythonanywhere)
            07:05 ~ $ pa_autoconfigure_django.py https://github.com/khizirsiddiqui/gammaLearning
            < Running API sanity checks >
               \
                ~<:>>>>>>>>>
            Traceback (most recent call last):
              File "/home/khizirsiddiqui/.local/bin/pa_autoconfigure_django.py", line 56, in <module>
                main(arguments['<git-repo-url>'], arguments['--domain'], arguments['--python'], nuke=arguments.get('--nuke'))
              File "/home/khizirsiddiqui/.local/bin/pa_autoconfigure_django.py", line 34, in main
                project.sanity_checks(nuke=nuke)
              File "/home/khizirsiddiqui/.local/lib/python3.6/site-packages/pythonanywhere/project.py", line 22, in sanity_checks
                self.webapp.sanity_checks(nuke=nuke)
              File "/home/khizirsiddiqui/.local/lib/python3.6/site-packages/pythonanywhere/api.py", line 74, in sanity_checks
                raise SanityException(f'You already have a webapp for {self.domain}.\n\nUse the --nuke option if you want to replace it.')
            pythonanywhere.exceptions.SanityException: You already have a webapp for khizirsiddiqui.pythonanywhere.com.
            Use the --nuke option if you want to replace it.
            07:06 ~ $ pa_autoconfigure_django.py https://github.com/khizirsiddiqui/gammaLearning --nuke
            < Running API sanity checks >
               \
                ~<:>>>>>>>>>
            Cloning into '/home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com'...
            remote: Counting objects: 202, done.
            remote: Compressing objects: 100% (146/146), done.
            remote: Total 202 (delta 56), reused 195 (delta 49), pack-reused 0
            Receiving objects: 100% (202/202), 416.07 KiB | 0 bytes/s, done.
            Resolving deltas: 100% (56/56), done.
            Checking connectivity... done.
            < Creating virtualenv with Python3.6 >
               \
                utility.execute()
                ~<:>>>>>>>>>
            Removing khizirsiddiqui.pythonanywhere.com...
            Running virtualenv with interpreter /usr/bin/python3.6
            Using base prefix '/usr'
            New python executable in /home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/bin/python3.6
            Also creating executable in /home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/bin/python
            Installing setuptools, pip, wheel...done.
            virtualenvwrapper.user_scripts creating /home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/bin/predeactivate
            virtualenvwrapper.user_scripts creating /home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/bin/postdeactivate
            virtualenvwrapper.user_scripts creating /home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/bin/preactivate
            virtualenvwrapper.user_scripts creating /home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/bin/postactivate
            virtualenvwrapper.user_scripts creating /home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/bin/get_env_details

              ______________________________________________________________________
            / Pip installing -r /home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.c \
            \ om/requirements.txt (this may take a couple of minutes)                /
              ----------------------------------------------------------------------
               \
                ~<:>>>>>>>>>
            Looking in links: /usr/share/pip-wheels
            Collecting certifi==2018.4.16 (from -r /home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/requirements.txt (line 1))
              Using cached https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl
            Collecting chardet==3.0.4 (from -r /home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/requirements.txt (line 2))
              Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
            Collecting Django==2.0.5 (from -r /home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/requirements.txt (line 3))
              Using cached https://files.pythonhosted.org/packages/23/91/2245462e57798e9251de87c88b2b8f996d10ddcb68206a8a020561ef7bd3/Django-2.0.5-py3-none-any.whl
            Collecting django-widget-tweaks==1.4.2 (from -r /home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/requirements.txt (line 4))
              Using cached https://files.pythonhosted.org/packages/db/d0/c6b445cddfa7c4e1635ba6e38a0c29250230ff8616e06bffdc49620ec158/django_widget_tweaks-1.4.2-py2.py3-none-any.whl
            Collecting idna==2.6 (from -r /home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/requirements.txt (line 5))
              Using cached https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl
            Collecting Pillow==5.1.0 (from -r /home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/requirements.txt (line 6))
              Using cached https://files.pythonhosted.org/packages/5f/4b/8b54ab9d37b93998c81b364557dff9f61972c0f650efa0ceaf470b392740/Pillow-5.1.0-cp36-cp36m-manylinux1_x86_64.whl
            Collecting pytz==2018.4 (from -r /home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/requirements.txt (line 7))
              Using cached https://files.pythonhosted.org/packages/dc/83/15f7833b70d3e067ca91467ca245bae0f6fe56ddc7451aa0dc5606b120f2/pytz-2018.4-py2.py3-none-any.whl
            Collecting requests==2.18.4 (from -r /home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/requirements.txt (line 8))
              Using cached https://files.pythonhosted.org/packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl
            Collecting urllib3==1.22 (from -r /home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/requirements.txt (line 9))
              Using cached https://files.pythonhosted.org/packages/63/cb/6965947c13a94236f6d4b8223e21beb4d576dc72e8130bd7880f600839b8/urllib3-1.22-py2.py3-none-any.whl
            Installing collected packages: certifi, chardet, pytz, Django, django-widget-tweaks, idna, Pillow, urllib3, requests
            Successfully installed Django-2.0.5 Pillow-5.1.0 certifi-2018.4.16 chardet-3.0.4 django-widget-tweaks-1.4.2 idna-2.6 pytz-2018.4 requests-2.18.4 urllib3-1.22

            < Creating web app via API >
               \
                ~<:>>>>>>>>>

            < Adding static files mappings for /static/ and /media/ >
               \
                ~<:>>>>>>>>>

              __________________________________________________
            / Updating wsgi file at                              \
            \ /var/www/khizirsiddiqui_pythonanywhere_com_wsgi.py /
              --------------------------------------------------
               \
                ~<:>>>>>>>>>

            < Updating settings.py >
               \
                ~<:>>>>>>>>>

            < Running collectstatic >
               \
                ~<:>>>>>>>>>
            Traceback (most recent call last):
              File "/home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/manage.py", line 15, in <module>
                execute_from_command_line(sys.argv)
              File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
                utility.execute()
              File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
                self.fetch_command(subcommand).run_from_argv(self.argv)
              File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv
                self.execute(*args, **cmd_options)
              File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
                output = self.handle(*args, **options)
              File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 189, in handle
                collected = self.collect()
              File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 105, in collect
                for path, storage in finder.list(self.ignore_patterns):
              File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/contrib/staticfiles/finders.py", line 125, in list
                for path in utils.get_files(storage, ignore_patterns):
              File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/contrib/staticfiles/utils.py", line 28, in get_files
                directories, files = storage.listdir(location)
              File "/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/lib/python3.6/site-packages/django/core/files/storage.py", line 313, in listdir
                for entry in os.listdir(path):
            FileNotFoundError: [Errno 2] No such file or directory: '/home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/static'
            Traceback (most recent call last):
              File "/home/khizirsiddiqui/.local/bin/pa_autoconfigure_django.py", line 56, in <module>
                main(arguments['<git-repo-url>'], arguments['--domain'], arguments['--python'], nuke=arguments.get('--nuke'))
              File "/home/khizirsiddiqui/.local/bin/pa_autoconfigure_django.py", line 42, in main
                project.run_collectstatic()
              File "/home/khizirsiddiqui/.local/lib/python3.6/site-packages/pythonanywhere/django_project.py", line 87, in run_collectstatic
                '--noinput',
              File "/usr/lib/python3.6/subprocess.py", line 291, in check_call
                raise CalledProcessError(retcode, cmd)
            subprocess.CalledProcessError: Command '[PosixPath('/home/khizirsiddiqui/.virtualenvs/khizirsiddiqui.pythonanywhere.com/bin/python'), PosixPath('/ho
            me/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/manage.py'), 'collectstatic', '--noinput']' returned non-zero exit status 1.

If you look at

            FileNotFoundError: [Errno 2] No such file or directory: '/home/khizirsiddiqui/khizirsiddiqui.pythonanywhere.com/static'

Isn't that just because your gitrepo is supposed to have a static folder in it but you don't have it?

umm... But that works just fine in localhost.

do you already have the static directory created on localhost but not on pythonanywhere?

My git repository is updated. I am using exact same files at same locations on my localhost.

Does that folder exist?

static folder exists in one of my django apps folder (in my localhost and in git repo too)

If the tool says something doesn't exist, then you should check that it exists where the tool is running, not in some other places. Does it exist in your PythonAnywhere account?

My website works mostly fine by correcting the static URL in settings but the django admin interface doesn't have any CSS. I guess maybe the error is somewhat related to it.

See http://help.pythonanywhere.com/pages/DjangoStaticFiles/ and http://help.pythonanywhere.com/pages/DebuggingStaticFiles/