Deploy Django cms on Heruku

2019-05-29 00:13发布

I'm trying to deploy a Django CMS on Heruku. I follow the instruction at https://devcenter.heroku.com/articles/git - but when I run the last command this is the result:

(web1)users-imac:1web user$ git push heroku master
Counting objects: 453, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (439/439), done.
Writing objects: 100% (453/453), 1.21 MiB | 105 KiB/s, done.
Total 453 (delta 30), reused 0 (delta 0)

-----> Removing .DS_Store files

! Push rejected, no Cedar-supported app detected

To git@heroku.com:intense-oasis-8026.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:intense-oasis-8026.git'

So I guess something went wrong, not sure what.

Those my heroku login output:

 2013-07-07T14:20:41.610222+00:00 heroku[api]: Enable Logplex by alex.garulli@gmail.com
 2013-07-07T14:20:41.623083+00:00 heroku[api]: Release v2 created by alex.garulli@gmail.com
 2013-07-07T14:21:18+00:00 heroku[slug-compiler]: Slug compilation started
 2013-07-07T14:21:21+00:00 heroku[slug-compiler]: Slug compilation failed: no Cedar-supported app detected
 2013-07-07T14:22:25.296159+00:00 heroku[router]: at=info code= desc="Blank app"    method=GET path=/ host=intense-oasis-8026.herokuapp.com fwd="86.161.229.49" dyno= connect=   service= status=502 bytes=
 2013-07-07T14:22:25.474698+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=intense-oasis-8026.herokuapp.com fwd="86.161.229.49" dyno= connect= service= status=502 bytes=
 2013-07-07T21:53:38.496649+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/ host=intense-oasis-8026.herokuapp.com fwd="120.168.1.115" dyno= connect= service= status=502 bytes=
 2013-07-07T21:53:48.291460+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=intense-oasis-8026.herokuapp.com fwd="120.168.1.115" dyno= connect= service= status=502 bytes=
 2013-07-07T21:53:51.282218+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=intense-oasis-8026.herokuapp.com fwd="120.168.1.115" dyno= connect= service= status=502 bytes=
 2013-07-08T18:29:16+00:00 heroku[slug-compiler]: Slug compilation started
 2013-07-08T18:29:17+00:00 heroku[slug-compiler]: Slug compilation failed: no Cedar-  supported app detected

ok my Procfile worked , with foreman start

20:30:16 web.1  | started with pid 13580
20:30:16 web.1  | /usr/local/foreman/bin/foreman-runner: line 41: exec: gunicorn: not  found
20:30:16 web.1  | exited with code 127 
20:30:16 system | sending SIGTERM to all processes
SIGTERM received

But same results for git push heroku master

UPDATE

I guess my git push heroku master worked ...or at least loaded a lot of stuff...but know I have in my page

Application Error An error occurred in the application and your page could not be served. Please try again >>in a few moments.

If you are the application owner, check your logs for details.

Not sure what to do....

UPDATE

sorry but couldnt mange to push it on heroku

you can view all my code at https://bitbucket.org/agarulli/trydj/src

any ideas pls?

4条回答
Fickle 薄情
2楼-- · 2019-05-29 00:22

This is because Heroku cannot understand what kind of App this is or you do not have access to that git repo.

What you need to do is add your SSH key to your account in order for this to work, because this is probably the problem.

If this does not work, then try rebasing.

Could you give us more information regarding your configuration if you configured Heroku right? If you are new to git altogether, then I suggest that you learn how it works before you attempt this.

Also, make sure to send requirements.txt to heroku.

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-05-29 00:37

Do you have requirements.txt in your project root folder? Without it Heroku won't understand you want to install Python app.

查看更多
Juvenile、少年°
4楼-- · 2019-05-29 00:45

Make sure gunicorn & dj-database-url is in your requirements.txt file and add it to your settings.py file:

INSTALLED_APPS = (
    ...
    'gunicorn',
    ...
)

import dj_database_url
DATABASES['default'] = dj_database_url.config()

And choose one & change of your Procfile like this:

web: gunicorn YOUR_PROJECT_NAME.wsgi -b 0.0.0.0:$PORT

(Change YOUR_PROJECT_NAME into your project name)

or

web: python manage.py runserver 0.0.0.0:$PORT --noreload

(If you don't want to use Gunicorn server).

Recreate a new repository and new cedar by run following commands using Virtualenv:

workon YOUR_PROJECT
pip freeze > requirements.txt
rm -rf .git
git init
git add .
git commit -am "YOUR COMMIT"
heroku create --stack cedar
git push heroku master

Syncing your database using this command:

heroku run python manage.py syncdb

Open your application:

heroku open
查看更多
一夜七次
5楼-- · 2019-05-29 00:48

Make sure you have set up SSH key on your computer as describe this article: https://devcenter.heroku.com/articles/keys and then you can following this articles: https://devcenter.heroku.com/articles/django to deploy Django on Heroku.

Can you share the output of heroku logs command?

查看更多
登录 后发表回答