nickjj / docker-django-example

A production ready example Django app that's using Docker and Docker Compose.
MIT License
1.17k stars 249 forks source link

unbound variable #28

Closed B-Kluss closed 1 year ago

B-Kluss commented 1 year ago

Hello,

I've followed your Running this app manual and changed the name of the project with the rename-project script. Afterward, I built the project and run the migration. So, to test everything I wanted to run the 3 suggested ./run commands but I get for lint and format the following outputs: ./run lint ./run format ./run: line 56: @: unbound variable ./run: line 61: @: unbound variable

I guess something went wrong. Do you have any suggestions?

Best regards

nickjj commented 1 year ago

Hi,

That error happens because in the run script set -o nounset is set near the top. It doesn't allow variables to ever be undefined.

I'm guessing something happened with the .env file because if the run script tried to run with an unbound variable it's very possible the run script is sourcing that file expecting a variable to exist but the variable doesn't exist and it becomes undefined.

What did you rename your project to?

I can't reproduce that here. I just ran these steps and everything worked:

B-Kluss commented 1 year ago

Thank you for the very quick answer. In advance, do I have to change anything in the .env file? I've set up a new Project according to the mentioned steps above. So even with the name hmm, I'm still facing the error.

nickjj commented 1 year ago

The rename script will rename everything for you, no manual adjustments are needed.

Did you make any other adjustments?

What shell and version are you using? Bash, zsh or something else?

B-Kluss commented 1 year ago

No, I have not made any adjustments. I am using zsh and operating on OS X. My root directory is called test-repo but I guess it should have no effect on that issue.

B-Kluss commented 1 year ago

Got the same problem when using bash

nickjj commented 1 year ago

All of that sounds normal. I run zsh too, and the script itself is set to use bash.

If you run bash --version what version do you get back? I wonder if something isn't compatible with Bash 3.2 which is what comes on macOS by default.

Also for clarity, does everything work if you don't rename the project?

B-Kluss commented 1 year ago

The renaming process has no impact on the issue. I am using 3.2.57(1)-release as bash version.

nickjj commented 1 year ago

Did you copy the .env.example file to .env?

B-Kluss commented 1 year ago

Yes, I've copied it and have not applied any changes to it.

nickjj commented 1 year ago

I don't have a Mac but I can ask someone to test this on theirs tomorrow.

B-Kluss commented 1 year ago

Ok, I've updated bash to 5.1.12 and now it works as expected. Thank you for your support.

nickjj commented 1 year ago

Ah, that that was my suspicion but I would like this project to work with Bash 3.2.X which is the default version on macOS so I'll see what I can do.

B-Kluss commented 1 year ago

Alright, if there is anything I can test for you. Let me know.