sei-ec-remote / project-4-issues

Open an issue to receive help on project 4
0 stars 0 forks source link

DR Stack Deployment Question #229

Closed estebbins closed 11 months ago

estebbins commented 1 year ago

What stack are you using?

(ex: MERN(mongoose + react), DR(django + react), PEN, etc.)

DR

What's the problem you're trying to solve?

Wondering which debug to edit for deployment - assuming the DEBUG currently set to false for production, but wanted to ensure it wasn't both?

Post any code you think might be relevant (one fenced block per file)

# Determine if we are on local or production
if os.getenv('ENV') == 'development':
    # If we are on development, use the `DB_NAME_DEV` value
    # from the .env file as the database name
    DB_NAME = os.getenv('DB_NAME_DEV')
    DB = {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': DB_NAME,
    }
    # Set debug to true
    DEBUG = True

    CORS_ALLOW_CREDENTIALS = True
    # Only allow locally running client at port 3000 for CORS
    CORS_ALLOWED_ORIGINS = [
        "http://localhost:3000"
    ]
    #  https://fractalideas.com/blog/making-react-and-django-play-well-together-single-page-app-model/

    CSRF_TRUSTED_ORIGINS = ['http://localhost:3000']
    CORS_ORIGIN_WHITELIST = ['http://localhost:3000']
else:
    # If we are on production, use the dj_database_url package
    # to locate the database based on Heroku setup
    DB = dj_database_url.config()
    # Set debug to false
    DEBUG = False

    CORS_ALLOW_CREDENTIALS = True
    # Only allow the `CLIENT_ORIGIN` for CORS
    CORS_ORIGIN_WHITELIST = [
        os.getenv('CLIENT_ORIGIN')
    ]

If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?

no errors yet

What is your best guess as to the source of the problem?

deployment guide made for Django app with templates.

What things have you already tried to solve the problem?

nothing - this is a question!

Paste a link to your repository here

timmshinbone commented 1 year ago

Yeah, it's the second one that isn't in the development environment

estebbins commented 1 year ago

Thanks - there's more discrepancies from the boilerplate to the deployment guide.

I think if we could jump in a room and go through them quickly, then I can provide answers on here for others with DR stack regarding these.

timmshinbone commented 1 year ago

Yeah, that sounds good and we can use that info to update the boilerplate readme.

estebbins commented 1 year ago

Morning - I have my back end and front end deployed, but the homepage is hanging out in a loading phase. It should be showing that I have no games. Also would like guidance on seeding my production database and creating a superuser.

timmshinbone commented 1 year ago

For the django boilerplate, I'd recommend setting up a separate branch where you change your development database to the deployed database and running seed scripts/superuser creation from there. Then just don't merge that branch, all you have to do is commit(and I'd push it up) to switch between branches so you can develop locally when you need to and run scripts to the deployed from the specific branch for that.

estebbins commented 1 year ago

That makes sense - I will try that out! I still am troubleshooting my index API call that doesn't seem to be happening.