django-simple-deploy icon indicating copy to clipboard operation
django-simple-deploy copied to clipboard

Failed to deploy

Open qvisty opened this issue 3 years ago • 9 comments

I have a new error when trying to use automate-all:

(venvjq) PS C:\Users\Jesper\Documents\GitHub\lone\sfony\lonesfo> python .\manage.py simple_deploy --automate-all
Configuring project for deployment...
  Found .git dir at C:\Users\Jesper\Documents\GitHub\lone\sfony\lonesfo.
Automating all steps...
  Targeting Heroku deployment...
Configuring project for deployment to Heroku...

The --automate-all flag means simple_deploy will:
- Run `heroku create` for you, to create a new Heroku project.
- Commit all changes to your project that are necessary for deployment.
  - These changes will be committed to the current branch, so you may want
    to make a new branch for this work.
- Push these changes to Heroku.
- Run the initial set of migrations to set up the remote database.
- Open your deployed project in a new browser tab.

Are you sure you want to do this? (yes|no)
yes
  Running `heroku create`...
 »   Warning: heroku update available from 7.59.2 to 7.60.2.
Creating app... !
 !    You've reached the app limit of 5 apps for unverified accounts. Delete
 !    some apps or add a credit card to verify your account.
  Inspecting Heroku app...
=== floating-harbor-86305
Auto Cert Mgmt: false
Dynos:
Git URL:        https://git.heroku.com/floating-harbor-86305.git
Owner:          [email protected]
Region:         us
Repo Size:      0 B
Slug Size:      0 B
Stack:          heroku-20
Web URL:        https://floating-harbor-86305.herokuapp.com/
    Found Heroku app: floating-harbor-86305
  Setting Heroku environment variable...
ON_HEROKU: 1
    Set ON_HEROKU=1.
    This is used to define Heroku-specific settings.

  Looking for django-simple-deploy in requirements.txt...
    Found django-simple-deploy in requirements file.

  Looking in C:\Users\Jesper\Documents\GitHub\lone\sfony\lonesfo for Procfile...
    Found existing Procfile.

  Looking for gunicorn...
    Found gunicorn in requirements file.

  Making sure project can be served from Heroku...
    Found floating-harbor-86305.herokuapp.com in ALLOWED_HOSTS for the deployed project.

  Configuring project for Heroku database...
    Adding db-related packages...
    Found psycopg2 in requirements file.
    Found dj-database-url in requirements file.
   Checking Heroku db settings...
    Found import statement for dj-database-url.
    Found setting to configure Postgres on Heroku.

  Configuring static files for Heroku deployment...
    Adding staticfiles-related packages...
    Found whitenoise in requirements file.
    Configuring static files settings...
    Found STATIC_ROOT setting for Heroku.
    Found STATIC_URL setting for Heroku.
    Found STATICFILES_DIRS setting for Heroku.
    Checking for static files directory...
    Found non-empty static files directory.
  Setting DEBUG env var...
DEBUG: FALSE
    Set DEBUG config variable to FALSE.
    Found DEBUG setting for Heroku.
  Setting new secret key for Heroku...
SECRET_KEY: z1gtc3l9mo3usltlxdpaf80lo8h8zw9a3lyznqjh0k5hf28eru
    Set SECRET_KEY config variable.
    Found SECRET_KEY setting for Heroku.


Committing and pushing project...
  Adding changes...

  Committing changes...
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
  Pushing to heroku...
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
    Pushing branch main...
remote: Compressing source files... done.        
remote: Building source:        
remote: 
remote: -----> Building on the Heroku-20 stack        
remote: -----> Determining which buildpack to use for this app        
remote: -----> Python app detected        
remote: -----> No Python version was specified. Using the buildpack default: python-3.10.4        
remote:        To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes        
remote: -----> Installing python-3.10.4        
remote: -----> Installing pip 22.0.4, setuptools 60.10.0 and wheel 0.37.1        
remote: -----> Installing SQLite3        
remote: -----> Installing requirements with pip        
remote:        ERROR: Exception:        
remote:        Traceback (most recent call last):        
remote:          File "/app/.heroku/python/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper
remote:            status = run_func(*args)
remote:          File "/app/.heroku/python/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 205, in wrapper        
remote:            return func(self, options, args)
remote:          File "/app/.heroku/python/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 305, in run
remote:            reqs = self.get_requirements(args, options, finder, session)
remote:          File "/app/.heroku/python/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 436, in get_requirements
remote:            for parsed_req in parse_requirements(
remote:          File "/app/.heroku/python/lib/python3.10/site-packages/pip/_internal/req/req_file.py", line 145, in parse_requirements
remote:            for parsed_line in parser.parse(filename, constraint):
remote:          File "/app/.heroku/python/lib/python3.10/site-packages/pip/_internal/req/req_file.py", line 326, in parse
remote:            yield from self._parse_and_recurse(filename, constraint)
remote:          File "/app/.heroku/python/lib/python3.10/site-packages/pip/_internal/req/req_file.py", line 331, in _parse_and_recurse
remote:            for line in self._parse_file(filename, constraint):
remote:          File "/app/.heroku/python/lib/python3.10/site-packages/pip/_internal/req/req_file.py", line 360, in _parse_file
remote:            _, content = get_file_content(filename, self._session)
remote:          File "/app/.heroku/python/lib/python3.10/site-packages/pip/_internal/req/req_file.py", line 533, in get_file_content
remote:            content = auto_decode(f.read())
remote:          File "/app/.heroku/python/lib/python3.10/site-packages/pip/_internal/utils/encoding.py", line 26, in auto_decode
remote:            return data[len(bom) :].decode(encoding)
remote:        UnicodeDecodeError: 'utf-16-le' codec can't decode byte 0x2e in position 646: truncated data        
remote:  !     Push rejected, failed to compile Python app.        
remote: 
remote:  !     Push failed        
remote:  !        
remote:  ! ## Warning - The same version of this code has already been built: 58e34bc5fb87bccc00c426f49c91dafe231e7213        
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 58e34bc5fb87bccc00c426f49c91dafe231e7213
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...        
remote: 
remote: !       Push rejected to floating-harbor-86305.
remote:
To https://git.heroku.com/floating-harbor-86305.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/floating-harbor-86305.git'
Traceback (most recent call last):
  File ".\manage.py", line 22, in <module>
    main()
  File ".\manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\Jesper\Documents\GitHub\lone\sfony\lonesfo\venvjq\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "C:\Users\Jesper\Documents\GitHub\lone\sfony\lonesfo\venvjq\lib\site-packages\django\core\management\__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\Jesper\Documents\GitHub\lone\sfony\lonesfo\venvjq\lib\site-packages\django\core\management\base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\Jesper\Documents\GitHub\lone\sfony\lonesfo\venvjq\lib\site-packages\django\core\management\base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "C:\Users\Jesper\Documents\GitHub\lone\sfony\lonesfo\venvjq\lib\site-packages\simple_deploy\management\commands\simple_deploy.py", line 75, in handle
    self._parse_cli_options(options)
  File "C:\Users\Jesper\Documents\GitHub\lone\sfony\lonesfo\venvjq\lib\site-packages\simple_deploy\management\commands\simple_deploy.py", line 104, in _parse_cli_options 
    self._check_platform()
  File "C:\Users\Jesper\Documents\GitHub\lone\sfony\lonesfo\venvjq\lib\site-packages\simple_deploy\management\commands\simple_deploy.py", line 115, in _check_platform    
    hd.deploy()
  File "C:\Users\Jesper\Documents\GitHub\lone\sfony\lonesfo\venvjq\lib\site-packages\simple_deploy\management\commands\utils\deploy_heroku.py", line 40, in deploy        
    self._conclude_automate_all()
  File "C:\Users\Jesper\Documents\GitHub\lone\sfony\lonesfo\venvjq\lib\site-packages\simple_deploy\management\commands\utils\deploy_heroku.py", line 391, in _conclude_automate_all
    self.sd.execute_command(cmd)
  File "C:\Users\Jesper\Documents\GitHub\lone\sfony\lonesfo\venvjq\lib\site-packages\simple_deploy\management\commands\simple_deploy.py", line 299, in execute_command    
    raise subprocess.CalledProcessError(p.returncode, p.args)
subprocess.CalledProcessError: Command '['git', 'push', 'heroku', 'main']' returned non-zero exit status 1.

The github repo is here: https://github.com/qvisty/lonesfo

qvisty avatar Jun 05 '22 19:06 qvisty

How can I resolve this?

qvisty avatar Jun 05 '22 19:06 qvisty

Hi again, sorry to leave you waiting a few days. I am swamped with work for the next couple weeks, but should be able to spend more time on this project towards the end of June. From a quick look, I wonder if there are any language settings that are affecting this.

(Looking at this line in your requirements file after running simple_deploy.)

ehmatthes avatar Jun 09 '22 02:06 ehmatthes

No worries. It is not urgent. I did not change the language setting

qvisty avatar Jun 09 '22 04:06 qvisty

If you would still like to see this resolved, can you explain that last line in your requirements.txt file?

Also, if you try to look at the history of your requirements.txt file, this is a message that pops up.

Showing 13,497 changed files with 1,481,959 additions and 0 deletions

I'm not sure if that's because you have your venv in the repository, or if it's because of some binary files that are included, but this seems to have nothing to do with django-simple-deploy.

ehmatthes avatar Jul 12 '22 02:07 ehmatthes

Im on vaccination right now without pc. I will respond when I get home. Ok?

If it is chinese chars I dont know how they got there. (I saw them an other time)

qvisty avatar Jul 12 '22 09:07 qvisty

No problem and no rush, I'll leave this open. Enjoy your vacation!

ehmatthes avatar Jul 12 '22 15:07 ehmatthes

I got away from this one. I will get back to it soon, promise :)

qvisty avatar Aug 03 '22 20:08 qvisty

I tried again now. Deleted requirements.txt and the two procfiles. Made a new requirements file. Still doesnt work. "Limit of 5 free apps on Heroku reached". I delete them all. I then ran django_simple deploy automate all. It asks me to run heroku create. I did. It now says "CommandError: No Heroku app name has been detected.". Now what? :)

qvisty avatar Aug 07 '22 11:08 qvisty

Hi there, sorry if I just drop in, but I've got the same error over and over again trying to deploy my app:

./manage.py simple_deploy --automate-all --platform heroku


Are you sure you want to do this? (yes|no) 
yes
  Running `heroku create`...
https://powerful-beyond-39009.herokuapp.com/ | https://git.heroku.com/powerful-beyond-39009.git
  Inspecting Heroku app...
 ▸    No app specified.
 ▸    USAGE: heroku info my-app
CommandError: No Heroku app name has been detected.

- The simple_deploy command assumes you have already run 'heroku create'
  to start the deployment process.
- Please run 'heroku create', and then run
  'python manage.py simple_deploy' again.
- If you haven't already done so, you will need to install the Heroku CLI:
  https://devcenter.heroku.com/articles/heroku-cli

MacOS BigSur, Python 3.8.13, Django 4.1, Poetry version 1.1.14

Thank you.


UPD: Got it now: I haven't added heroku git remote repository. After I typed heroku git:remote -a <app_name> everything went smoothly. Thanks anyway, the package is great.

RashidRysaev avatar Aug 30 '22 14:08 RashidRysaev