Skip to content
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

setup.sh script attempts to copy file in bakerydemo which doesn't exist anymore #54

Closed
floels opened this issue Mar 9, 2023 · 3 comments

Comments

@floels
Copy link
Contributor

floels commented Mar 9, 2023

Hi,

When running the setup.sh script locally to set up my local Wagtail development environment, I got the following error in the terminal:

Creating local settings file cp: bakerydemo/bakerydemo/settings/local.py.docker-compose-example: No such file or directory

The error comes from the following line of the script:

cp bakerydemo/bakerydemo/settings/local.py.docker-compose-example bakerydemo/bakerydemo/settings/local.py

and indeed bakerydemo/settings/local.py.docker-compose-example doesn't exist anymore in bakerydemo. It was removed in this PR merged three weeks ago.

I guess the correct command in setup.sh would be:

cp bakerydemo/bakerydemo/settings/local.py.example bakerydemo/bakerydemo/settings/local.py

I can make a PR to change it if you confirm.

@saevarom
Copy link
Collaborator

saevarom commented Mar 9, 2023

Thanks @floels

I think that just referencing local.py is not sufficient, we need the lines from the old docker compose example file so that the project uses the env variable DATABASE_URL to connect to the db.

import dj_database_url

# Override settings here
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)

But I think we can just create our own local settings example file to maintain in this repository. If you want to create a PR then go for it.

@floels
Copy link
Contributor Author

floels commented Mar 9, 2023

Hi @saevarom,

Thanks for the quick reply. Ok so just to make sure I understand, we would:

  1. create a bakerydemo-settings-local.example file with the following content:
import dj_database_url

# Override settings here
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)

at the root of this docker-wagtail-develop repo,

  1. replace:

cp bakerydemo/bakerydemo/settings/local.py.docker-compose-example bakerydemo/bakerydemo/settings/local.py

in setup.sh with:

cp bakerydemo-settings-local.example bakerydemo/bakerydemo/settings/local.py?

@saevarom
Copy link
Collaborator

saevarom commented Mar 9, 2023

Yes, almost, but the full contents of the bakerydemo-settings-local.example would probably need to be:

from bakerydemo.settings.dev import *   # noqa
import dj_database_url

# Override settings here
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)

I omitted the first line to only show what the difference between the files was

saevarom pushed a commit that referenced this issue Mar 9, 2023
…dingly (#54) (#55)

* Add example file for bakerydemo/bakerydemo/settings/local.py (#54)

* Copy example file to bakerydemo/bakerydemo/settings/local.py in setup.sh script
@saevarom saevarom closed this as completed Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants