-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat]: Add heroku configuration for deployment #103
base: develop
Are you sure you want to change the base?
Conversation
@codesankalp @isabelcosta Can you please review this PR. Thanks 🙂 |
@Rahulm2310 Will this be able to deploy from the Heroku pipeline through github? QA checks are also failing. |
main/settings.py
Outdated
@@ -28,9 +29,9 @@ | |||
SECRET_KEY = "7ibm!g0j@gs7kszwav!6$*lar(+!!l3tpm@09s%csl2bj)l+p4" | |||
|
|||
# SECURITY WARNING: don't run with debug turned on in production! | |||
DEBUG = True | |||
DEBUG = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For deployment take this DEBUG value from environment variables else for development make this True.
@Rahulm2310 Follow the README guidelines for QA-Checks as both workflows are failing. |
main/settings.py
Outdated
@@ -155,3 +156,9 @@ | |||
# https://docs.djangoproject.com/en/3.0/howto/static-files/ | |||
|
|||
STATIC_URL = "/static/" | |||
|
|||
STATIC_ROOT = os.path.join(BASE_DIR, ‘static’) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't include backticks use double-quoted strings.
@codesankalp Can you please explain why both workflows are still failing? |
@Rahulm2310 Try to follow the commands mentioned in README - https://github.com/anitab-org/open-source-programs-backend#qa-checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rahulm2310
I tried it on the local system and it is returning 500 server errors for URL which is working.
Please look into that.
Also, You have updated the requirements.txt wrong. Either use the virtual-env to update packages or add dependencies separately. As currently there are 54 dependencies including flask and other stuff which is not needed I think.
For testing, you can use |
@Rahulm2310 I have DJANGO_DEBUG in my |
@codesankalp I came to know that gunicorn is for unix environment and is incompatible with windows. There is an open issue on the gunicorn's github repo for this. |
Then @Rahulm2310 there is only one option try deploying on Heroku for testing your code. |
@codesankalp is this the correct way |
@Rahulm2310 The line that you have added is correct i.e. it will make DEBUG=False when |
@codesankalp I tried deploying to heroku. But getting this error when running Although, I have |
Try to rebase it with the current develop branch then there will be no errors regarding Zulip Key. |
@codesankalp I rebased with current develop, pushed the download file to heroku and then |
@codesankalp getting |
@Rahulm2310 See this for reference: https://sendgrid.com/docs/ui/sending-email/sender-verification/ |
@codesankalp I have my sender email verified on sendgrid. Can I add you as a collaborator to the deployed project on heroku. |
No, It is not needed @Rahulm2310. |
@codesankalp I tried consoleBackend, and I am getting the verification mail in the console.
yeah I created a super user for heroku app and then created a new user from the admin site. |
@Rahulm2310 In that case I can approve this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rahulm2310 CI builds are failing. Please look into them.
Also, your branch is not up-to-date with our default branch. Please rebase your branch.
Look into these requests too:- 👇
ProcFile
Outdated
@@ -0,0 +1 @@ | |||
web: gunicorn main.wsgi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a newline at the end
README.md
Outdated
@@ -95,8 +95,11 @@ Follow the given instructions for Login into the app. | |||
6. Click Create & View. | |||
7. The API KEY is generated and displayed to you just once. So be sure to copy and save it somewhere. | |||
|
|||
3. `DJANGO_DEBUG` - Set its value to `False` for deployment (not needed for development). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather leave it as DEBUG
. Simpler, the better
main/settings.py
Outdated
|
||
ALLOWED_HOSTS = [] | ||
ALLOWED_HOSTS = ["https://open-source-programs-backend.herokuapp.com"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add https
in allowed host
ALLOWED_HOSTS = ["https://open-source-programs-backend.herokuapp.com"] | |
ALLOWED_HOSTS = ["open-source-programs-backend.herokuapp.com"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to change the name to anitab-forms-backend
main/settings.py
Outdated
STATIC_ROOT = os.path.join(BASE_DIR, ‘static’) | ||
|
||
# Activate Django-Heroku. | ||
django_heroku.settings(locals()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can try something like this
django_heroku.settings(locals()) | |
from socket import gethostname | |
HOSTNAME = gethostname() | |
if HOSTNAME == 'open-source-programs-backend.herokuapp.com': | |
import django_heroku | |
django_heroku.settings(locals()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@devkapilbansal Why use this when django_heroku doesn't affect the development environment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of setting config if we are using it in development. However, we can ignore this 😕
What's not broken need not to be fixed
@Rahulm2310 Can you please resolve the merge conflict and do the suggested changes? |
@codesankalp was a bit more involved in OSH. Will apply the suggested changes asap. 🙂 |
Hi, @Rahulm2310 can you do the changes in this, as the deployment of the backend, is one of the high priority things for us currently. |
@Rahulm2310 It is a priority now because the deployed backend is required. Can you please update the PR? |
@codesankalp can you help me identify why CI builds are failing |
Not sure, It is something related to postgres. I think while deleting the database it can't delete it. |
@@ -0,0 +1,4 @@ | |||
[api] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rahulm2310 Remove this file from the commit
|
||
ALLOWED_HOSTS = [] | ||
ALLOWED_HOSTS = ["anitab-forms-backend.herokuapp.com"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rahulm2310 I think this is deployed in your Heroku account. So adding it here wouldn't be a nice logic.
Description
Add heroku configuration for deployment
Fixes #80
Instructions for deployment :
Type of Change:
Code/Quality Assurance Only
How Has This Been Tested?
Not Applicable
Checklist:
Code/Quality Assurance Only