Forums

Error in running pa_autoconfigure_django.py https://github.com/sumitkhajanchi/my-first-blog.git

Hi All, I got below error when trying to execute command : pa_autoconfigure_django.py https://github.com/sumitkhajanchi/my-first-blog.git

Below are snippet from the pythonanywhere command line :

17:41 ~ $ pa_autoconfigure_django.py https://github.com/sumitkhajanchi/my-first-blog.git

< Running API sanity checks > \ ~<:>>>>>>>>> Traceback (most recent call last): File "/home/SumitKhajanchi/.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/SumitKhajanchi/.local/bin/pa_autoconfigure_django.py", line 34, in main project.sanity_checks(nuke=nuke) File "/home/SumitKhajanchi/.local/lib/python3.6/site-packages/pythonanywhere/project.py", line 22, in sanity_checks self.webapp.sanity_checks(nuke=nuke) File "/home/SumitKhajanchi/.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 sumitkhajanchi.pythonanywhere.com

And it is not activating the virtual env automatically. Please help.

Read the exception: "You already have a webapp for sumitkhajanchi.pythonanywhere.com". The script is not going to destroy it if you don't give it the --nuke option.

Daaahh. Same happened to me. Thank you so much. I read it like 10 times but I did not actually read it.

:D

            / ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄\
<<<<<<:>~  <   Yay!          |
             \_________/

where should i give the nuke option

something like this: pa_autoconfigure_django.py --nuke https://github.com/sumitkhajanchi/my-first-blog.git

Same happened to me. Thank you so much.

Glad we could help :-)

Thank you so much

so should i continue with command line of creating an admin user

can you give more details about what you are trying to do?

how will apply the nuke option?

Perhaps you could let us know exactly what error message you're getting when you run the script?

[edited by admin: formatting]

14:06 ~ $ pa_autoconfigure_django.py --nuke  https://github.con/KapisK
ay/the_scribe.git                                                     
< Running API sanity checks >
   \
    ~<:>>>>>>>>>
Cloning into '/home/Konadu/konadu.pythonanywhere.com'...
fatal: unable to access 'https://github.con/KapisKay/the_scribe.git/':
 Received HTTP code 403 from proxy after CONNECT
Traceback (most recent call last):
  File "/home/Konadu/.local/bin/pa_autoconfigure_django.py", line 52, 
in <module>
    main(arguments['<git-repo-url>'], arguments['--domain'], arguments
['--python'], nuke=arguments.get('--nuke'))
  File "/home/Konadu/.local/bin/pa_autoconfigure_django.py", line 35, 
in main
    project.download_repo(repo_url, nuke=nuke),
  File "/home/Konadu/.local/lib/python3.6/site-packages/pythonanywhere
/django_project.py", line 16, in download_repo
    subprocess.check_call(['git', 'clone', repo, str(self.project_path
)])
  File "/usr/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['git', 'clone', 'https://gith
ub.con/KapisKay/the_scribe.git', '/home/Konadu/konadu.pythonanywhere.c
om']' returned non-zero exit status 128.

you most likely mean github.com, not github.con

@conrad: You God you!

Thanks

how can i host my second web app in pythonanywhere? I have created second virtual env but when I am uploading source code, it is showing the same error.

There are multiple errors in this thread. Which one are you getting?

yeah, actually I do not know the procedure of how to host my second website here its actually showing use nuke every time.

I removed everything. my doubt is simple, I want to know the procedure of how to host a second website in pythonanywhere?

If it's showing that you need to nuke the web app, then you're trying to create a web app at the address of a web app that you already have. A new web app needs a new address.

what is the new address?

You can either use <some string>-<username>.pythonanywhere.com (for example: test-lincolnstep.pythonanywhere.com) or you can use a domain that you already own. See http://help.pythonanywhere.com/pages/CustomDomains/

(0dminnimda.pythonanywhere.com) 15:30 ~/0dminnimda.pythonanywhere.com $ pa_autoconfigure_django.py --nuke https://github.com/0dminnimda/site.git < Running API sanity checks > \ ~<:>>>>>>>>> fatal: Could not get current working directory: No such file or directory Traceback (most recent call last): File "/home/0dminnimda/.local/bin/pa_autoconfigure_django.py", line 52, in <module> main(arguments['<git-repo-url>'], arguments['--domain'], arguments['--python'], nuke=arguments.get('--nuke')) File "/home/0dminnimda/.local/bin/pa_autoconfigure_django.py", line 35, in main project.download_repo(repo_url, nuke=nuke), File "/home/0dminnimda/.local/lib/python3.7/site-packages/pythonanywhere/django_project.py", line 16, in download_repo subprocess.check_call(['git', 'clone', repo, str(self.project_path)]) File "/usr/lib/python3.7/subprocess.py", line 328, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['git', 'clone', 'https://github.com/0dminnimda/site.git', '/home/0dminnimda/0dminnimda.pythonanywhere.com']' returned non-zero exit status 128.

You are running the script from inside the directory that it's trying to work on. Try running it from your home directory.

it's already decided

What is?

Hello,

I'm getting the same error of: pythonanywhere.exceptions. : You already have a webapp for xxx.pythonanywhere.com

However, I have an app on the xxx.pythonanywhere.com and would like for the bash to point to my new configured webapp for (example) www.test.com

How could I get the bash to point to the new webapp without replacing my existing other webapp?

Just use the --domain command-line option -- for example:

pa_autoconfigure_django.py https://github.com/something --domain=www.test.com --python=3.6

thank you!

Error in running pa_autoconfigure_django.py, here is the snippet from error. pleasse help

$ pa_autoconfigure_django.py https://github.com/moon341/my-first-blog.git < Running API sanity checks > \ ~<:>>>>>>>>> Traceback (most recent call last): File "/home/moon341/.local/bin/pa_autoconfigure_django.py", line 52, in <module> main(arguments['<git-repo-url>'], arguments['--domain'], arguments['--python'], nuke=arguments. get('--nuke')) File "/home/moon341/.local/bin/pa_autoconfigure_django.py", line 34, in main project.sanity_checks(nuke=nuke) File "/home/moon341/.local/lib/python3.6/site-packages/pythonanywhere/project.py", line 24, in sa nity_checks self.webapp.sanity_checks(nuke=nuke) File "/home/moon341/.local/lib/python3.6/site-packages/pythonanywhere/api.py", line 80, in sanity _checks """ pythonanywhere.exceptions.SanityException: Could not find your API token. You may need to create it on the Accounts page? You will also need to close this console and open a new one once you've done that.

Looks like it could not find your API token. Have you created it on the Accounts page? You will also need to open a new console once you've done that.

bash pa_autoconfigure_django.py command not found. and i think because i wiped a bunch of files from my homedir. how do i retrieve them back?

You can just re-install the helper scripts:

pip3.5 install --user pythonanywhere

go to web in pythonanywhere -> then go to WSGI configuration file: -> then just change your < project_home = '/home/domain of pythonanywhere /project name on github'> This works for me almost after 3 days

pa_autoconfigure_django.py --nuke https://github.com/Ciconelle/my-first-blog.git

< Running API sanity checks > \ ~<:>>>>>>>>> Cloning into '/home/Ciconelle/ciconelle.pythonanywhere.com'... remote: Enumerating objects: 21, done. remote: Counting objects: 100% (21/21), done. remote: Compressing objects: 100% (17/17), done. remote: Total 21 (delta 0), reused 18 (delta 0), pack-reused 0 Unpacking objects: 100% (21/21), 4.65 KiB | 15.00 KiB/s, done. Traceback (most recent call last): File "/home/Ciconelle/.local/bin/pa_autoconfigure_django.py", line 54, in <module> nuke=arguments.get('--nuke') File "/home/Ciconelle/.local/bin/pa_autoconfigure_django.py", line 32, in main project.ensure_branch(branch), File "/home/Ciconelle/.local/lib/python3.6/site-packages/pythonanywhere/django_project.py", line 29, in ensure_branch "There are many branches in your repo. " pythonanywhere.exceptions.SanityException: There are many branches in your repo. You need to specify which branch to use by adding --branch=<branch> option to the command.

Someone can help me?

What if you use --branch option on the command as suggested in the message?

I have the same problem:

17:24 ~ $ pa_autoconfigure_django.py https://github.com/KrzychuKrzych/djangoblog.git                                                                                   
< Running API sanity checks >
   \
    ~<:>>>>>>>>>
Traceback (most recent call last):
  File "/home/KrzychuKrzych/.local/bin/pa_autoconfigure_django.py", line 49, in <module>
    main(
  File "/home/KrzychuKrzych/.local/bin/pa_autoconfigure_django.py", line 30, in main
    project.sanity_checks(nuke=nuke)
  File "/home/KrzychuKrzych/.local/lib/python3.9/site-packages/pythonanywhere/project.py", line 24, in sanity_checks
    self.webapp.sanity_checks(nuke=nuke)
  File "/home/KrzychuKrzych/.local/lib/python3.9/site-packages/pythonanywhere/api/webapp.py", line 40, in sanity_checks
    raise SanityException(
pythonanywhere.exceptions.SanityException: You already have a webapp for krzychukrzych.pythonanywhere.com.
Use the --nuke option if you want to replace it.

What can I do to fix it??

[edit by admin: formatting]

Did you try the --nuke option, as suggested in the error message?

Now I have this one:

Traceback (most recent call last):
  File "/home/KrzychuKrzych/krzychukrzych.pythonanywhere.com/manage.py", line 22, in <module>
    main()
  File "/home/KrzychuKrzych/krzychukrzych.pythonanywhere.com/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/home/KrzychuKrzych/.virtualenvs/krzychukrzych.pythonanywhere.com/lib/python3.6/site-packages/django/core/management/__init__.py", line 419, in execute_from_co
mmand_line
    utility.execute()
  File "/home/KrzychuKrzych/.virtualenvs/krzychukrzych.pythonanywhere.com/lib/python3.6/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/KrzychuKrzych/.virtualenvs/krzychukrzych.pythonanywhere.com/lib/python3.6/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/KrzychuKrzych/.virtualenvs/krzychukrzych.pythonanywhere.com/lib/python3.6/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/home/KrzychuKrzych/.virtualenvs/krzychukrzych.pythonanywhere.com/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
 line 187, in handle
    collected = self.collect()
  File "/home/KrzychuKrzych/.virtualenvs/krzychukrzych.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/KrzychuKrzych/.virtualenvs/krzychukrzych.pythonanywhere.com/lib/python3.6/site-packages/django/contrib/staticfiles/finders.py", line 130, in list
    for path in utils.get_files(storage, ignore_patterns):
  File "/home/KrzychuKrzych/.virtualenvs/krzychukrzych.pythonanywhere.com/lib/python3.6/site-packages/django/contrib/staticfiles/utils.py", line 23, in get_files
    directories, files = storage.listdir(location)
  File "/home/KrzychuKrzych/.virtualenvs/krzychukrzych.pythonanywhere.com/lib/python3.6/site-packages/django/core/files/storage.py", line 330, in listdir
    for entry in os.scandir(path):
FileNotFoundError: [Errno 2] No such file or directory: '/home/KrzychuKrzych/krzychukrzych.pythonanywhere.com/static'
Traceback (most recent call last):
  File "/home/KrzychuKrzych/.local/bin/pa_autoconfigure_django.py", line 54, in <module>
    nuke=arguments.get('--nuke')
  File "/home/KrzychuKrzych/.local/bin/pa_autoconfigure_django.py", line 39, in main
    project.run_collectstatic()
  File "/home/KrzychuKrzych/.local/lib/python3.6/site-packages/pythonanywhere/django_project.py", line 121, in run_collectstatic
    'collectstatic',
  File "/usr/local/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/KrzychuKrzych/.virtualenvs/krzychukrzych.pythonanywhere.com/bin/python', '/home/KrzychuKrzych/krzychukrzych.pythonanywh
ere.com/manage.py', 'collectstatic']' returned non-zero exit status 1.

[edit by admin: formatting]

Do you deploy public github repo? Could you give us a link to it?

https://github.com/KrzychuKrzych/djangoblog

Its public.

OK, so the important part of that error message is this:

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

In your github repo you have this in your settings:

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

However, neither of those directories exist in your repo. I recommend that you create them. One thing to be aware of is that git will ignore empty directories, so you can't add them as purely-empty ones -- instead, use this trick to create one that is essentially empty but actually contains one hidden file.

Hi, I used the ---nuke when --python=3.8 didn't work out for me but it still didn't activate my virtualenv. What should I do. Am still getting this error. In the output, its saying removing oidowu.pythonanywhere.com

23:03 ~ $ pa_autoconfigure_django.py --python=3.8 https://github.com/Oluwatosin-svg/my-fi
rst-blog.git
< Running API sanity checks >
   \
    ~<:>>>>>>>>>
Traceback (most recent call last):
  File "/home/oidowu3/.local/bin/pa_autoconfigure_django.py", line 49, in <module>
    main(
  File "/home/oidowu3/.local/bin/pa_autoconfigure_django.py", line 30, in main
    project.sanity_checks(nuke=nuke)
  File "/home/oidowu3/.local/lib/python3.8/site-packages/pythonanywhere/project.py", line
 24, in sanity_checks
    self.webapp.sanity_checks(nuke=nuke)
  File "/home/oidowu3/.local/lib/python3.8/site-packages/pythonanywhere/api/webapp.py", l
ine 40, in sanity_checks
    raise SanityException(
pythonanywhere.exceptions.SanityException: You already have a webapp for oidowu3.pythonan
ywhere.com.
Use the --nuke option if you want to replace it.
23:05 ~ $ pa_autoconfigure_django.py --nuke https://github.com/Oluwatosin-svg/my-first-bl
og.git                                                                                   
< Running API sanity checks >
   \
    ~<:>>>>>>>>>
Cloning into '/home/oidowu3/oidowu3.pythonanywhere.com'...
remote: Enumerating objects: 8766, done.
remote: Counting objects: 100% (8766/8766), done.
remote: Compressing objects: 100% (5586/5586), done.
remote: Total 8766 (delta 2121), reused 8766 (delta 2121), pack-reused 0
Receiving objects: 100% (8766/8766), 13.21 MiB | 24.50 MiB/s, done.
Resolving deltas: 100% (2121/2121), done.
Updating files: 100% (6468/6468), done.
< Creating virtualenv with Python3.6 >
   \
    ~<:>>>>>>>>>
Removing oidowu3.pythonanywhere.com...
created virtual environment CPython3.6.13.final.0-64 in 14354ms
  creator CPython3Posix(dest=/home/oidowu3/.virtualenvs/oidowu3.pythonanywhere.com, clear
=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=cop
y, app_data_dir=/home/oidowu3/.local/share/virtualenv)
    added seed packages: pip==21.1.2, setuptools==57.0.0, wheel==0.36.2
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActiva
tor,XonshActivator
virtualenvwrapper.user_scripts creating /home/oidowu3/.virtualenvs/oidowu3.pythonanywhere
.com/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/oidowu3/.virtualenvs/oidowu3.pythonanywhere
.com/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/oidowu3/.virtualenvs/oidowu3.pythonanywhere
.com/bin/preactivate
virtualenvwrapper.user_scripts creating /home/oidowu3/.virtualenvs/oidowu3.pythonanywhere
.com/bin/postactivate
virtualenvwrapper.user_scripts creating /home/oidowu3/.virtualenvs/oidowu3.pythonanywhere
.com/bin/get_env_details
  ___________________________________________________________________
/                                                                     \
| Pip installing -r                                                   |
| /home/oidowu3/oidowu3.pythonanywhere.com/requirements.txt (this may |
| take a couple of minutes)                                           |
\                                                                     /
  -------------------------------------------------------------------
   \
    ~<:>>>>>>>>>
Looking in links: /usr/share/pip-wheels
Collecting Django~=3.2.10
  Downloading Django-3.2.14-py3-none-any.whl (7.9 MB)
     |████████████████████████████████| 7.9 MB 19.5 MB/s 
Collecting asgiref<4,>=3.3.2
  Downloading asgiref-3.4.1-py3-none-any.whl (25 kB)
Collecting pytz
  Downloading pytz-2022.1-py2.py3-none-any.whl (503 kB)
     |████████████████████████████████| 503 kB 15.6 MB/s 
Collecting sqlparse>=0.2.2
  Using cached sqlparse-0.4.2-py3-none-any.whl (42 kB)
Collecting typing-extensions
  Downloading typing_extensions-4.1.1-py3-none-any.whl (26 kB)
Installing collected packages: typing-extensions, sqlparse, pytz, asgiref, Django
Successfully installed Django-3.2.14 asgiref-3.4.1 pytz-2022.1 sqlparse-0.4.2 typing-exte
nsions-4.1.1
< Creating web app via API >
   \
    ~<:>>>>>>>>>
< Adding static files mappings for /static/ and /media/ >
   \
    ~<:>>>>>>>>>
< Updating wsgi file at /var/www/oidowu3_pythonanywhere_com_wsgi.py >
   \
    ~<:>>>>>>>>>
< Updating settings.py >
   \
    ~<:>>>>>>>>>
< Running collectstatic >
   \
    ~<:>>>>>>>>>
128 static files copied to '/home/oidowu3/oidowu3.pythonanywhere.com/static'.
< Running migrate database >
   \
    ~<:>>>>>>>>>
Traceback (most recent call last):
  File "/home/oidowu3/oidowu3.pythonanywhere.com/manage.py", line 22, in <module>
    main()
  File "/home/oidowu3/oidowu3.pythonanywhere.com/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/home/oidowu3/.virtualenvs/oidowu3.pythonanywhere.com/lib/python3.6/site-packages
/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/home/oidowu3/.virtualenvs/oidowu3.pythonanywhere.com/lib/python3.6/site-packages
/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/oidowu3/.virtualenvs/oidowu3.pythonanywhere.com/lib/python3.6/site-packages
/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/oidowu3/.virtualenvs/oidowu3.pythonanywhere.com/lib/python3.6/site-packages
/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/home/oidowu3/.virtualenvs/oidowu3.pythonanywhere.com/lib/python3.6/site-packages
/django/core/management/base.py", line 89, in wrapped
File "/home/oidowu3/.virtualenvs/oidowu3.pythonanywhere.com/lib/python3.6/site-packages
/django/urls/resolvers.py", line 602, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/oidowu3/.virtualenvs/oidowu3.pythonanywhere.com/lib/python3.6/site-packages
/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/oidowu3/.virtualenvs/oidowu3.pythonanywhere.com/lib/python3.6/site-packages
/django/urls/resolvers.py", line 595, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/oidowu3/oidowu3.pythonanywhere.com/mysite/urls.py", line 21, in <module>
    path('', include('blog.urls')),
NameError: name 'include' is not defined
Traceback (most recent call last):
  File "/home/oidowu3/.local/bin/pa_autoconfigure_django.py", line 49, in <module>
    main(
  File "/home/oidowu3/.local/bin/pa_autoconfigure_django.py", line 40, in main
    project.run_migrate()
  File "/home/oidowu3/.local/lib/python3.8/site-packages/pythonanywhere/django_project.py
", line 132, in run_migrate
    subprocess.check_call([
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/oidowu3/.virtualenvs/oidowu3.pythonanywhe
re.com/bin/python', '/home/oidowu3/oidowu3.pythonanywhere.com/manage.py', 'migrate']' ret
urned non-zero exit status 1.

Make sure you're importing include from django.urls in /home/oidowu3/oidowu3.pythonanywhere.com/mysite/urls.py.

raise SanityException( thonanywhere.exceptions. SanityException: There are mi branch to use by adding --branch=<branch> option to the помогите пожалуйста решить

What did you try to do? What was the command?