0

I have a function that generates a bash script file '.sh' to create a django project and a few apps.

This is the bash file I generate:

#! /bin/bash
cd projectx
source projectxenv/Scripts/activate
python manage.py startapp app1
python manage.py startapp app2
deactivate

When I execute the bash I generated, it gives me the following errors:

django.core.management.base.CommandError: 'app1' conflicts with the name of an existing Python module and cannot be used as an app name. Please try another name.

django.core.management.base.CommandError: 'app2' conflicts with the name of an existing Python module and cannot be used as an app name. Please try another name.

I don't think app1 and app2 are existing modules, and also, I tried running these commands manually and they work, but when I try ./bash.sh, it doesn't work.

Lynkou
  • 36
  • 2
  • I guess this may help: https://stackoverflow.com/questions/7019070/cannot-start-any-django-app/18932847 – null_override Oct 29 '21 at 02:00
  • Actually I saw it already, it doesn't help at all. I'm well aware of the commands I'm using, and also as I said, I tried these commands manually in shell command and they work, they only don't work when executed as part of a bash file. – Lynkou Oct 29 '21 at 08:48
  • Maybe try changing the shebang line to `#!/usr/bin/env bash` – sytech Oct 29 '21 at 08:51
  • I'll change it to `#! /"""+directory+"env/"+"""/bin/env bash` and see (because it's a generated bash file on django) – Lynkou Oct 29 '21 at 08:55
  • Using `#!/usr/bin/env bash` should be sufficient to get the same results you see when running commands in your shell. `/usr/bin/env` is what you want -- it's not going to exist anywhere else. – sytech Oct 29 '21 at 08:56
  • For reference: [What is the difference between "#!/usr/bin/env bash" and "#!/usr/bin/bash"?](https://stackoverflow.com/q/16365130/5747944) – sytech Oct 29 '21 at 09:04

0 Answers0