Django+render+windows

Hello! I’m having issues deploying my Django web app on render: I tried following the guide as much as possible, but since I used only a virtual env (and not poetry) some parts were different (Instead of poetry add I used only pip install)
But I believe my main issue I have is with the build command: the guide tells me to use bash, but I’m on windows and I’m getting a bash\r’: No such file or directory" Error.

To try and fix this, I tried adding a gitattributes file (*.sh text eol=lf), which did not work;

I also tried uploading the staticfiles manually (instead of running ‘python manage.py collectstatic --no-input using the bash file’, which did not return any errors and ‘deployed’, but gave me back a Server 500 error (not sure if because something went wrong with this approach or something else entirely)

Any easy way to fix this? Maybe alternative ways to ‘build’? I could not find many issues similar to mine, but maybe I used the wrong terms to search

Hi Marcelo,

Thanks for reaching out.

I’m not quite clear on what your issue is, are you trying to run these commands on your local machine or when setting up a Render service? Using pip is fine and is used on other Render examples. I’m also not seeing any services on your account, but if a 500 error were being produced, I would expect it to be showing a stacktrace/cause in the service logs.

If you could share some more detailed examples of the issue you are experiencing that may help us troubleshoot it with you, e.g. any logs/errors/output from Render, specific URLs, service name/ID, reproduction steps, screenshots, etc. If you don’t want to share these details on the community forum, please feel free to raise a ticket with support@render.com

Thanks

Alan

Hey Alan, thanks for replying!

My issue is: when I’m trying to deploy for the first time on Render (pointing to my github repo) I get this issue:

Sorry, you did not see any services yesterday because I deleted them, I thought maybe I did something wrong so I’d try redo-ing them the steps on the django-render tutorial today and see if I could find my mistake… but as you can see, I’m still running into the same issue.

My current build.sh has the following:
#!/usr/bin/env bash

exit on error

set -o errexit

pip install -r requirements.txt

python manage.py collectstatic --no-input
python manage.py migrate

I see nothing on the Logs and I named my webservice as ‘yomitoku’ (not sure if that is the same thing as the ‘service name’).

EDIT: I tried again manually inserting the ‘staticfiles’ folder inside my repo (after building it locally) and it deployed correctly by using ‘pip install -r requirements.txt’ instead of a build.sh file.
I will probably have to do that (creating and migrating my staticfiles) manually, but since it’s just a small personal project it’s not a very big deal

Hi Marcelo,

I’m seeing successful builds on that service now, were you able to resolve your issue?

Alan

Hey, Alan. Yes, I am, thank you

bash\r: No such file

It seems that the script wasn’t able to find the bash executable because it tried to look it up as bash\r. The \r is the carriage return character and is used in Windows in the combination of \r\n whereas Linux uses only the linefeed character \n.

It’s weird that the script interprets the \r as being part of the executable name. For all the other people experiencing this: I assume it should work if the script is saved with a Linux line ending setting. Sublime Text (for example) has the following setting:

// Determines what character(s) are used to terminate each line in new files.
// Valid values are 'system' (whatever the OS uses), 'windows' (CRLF) and
// 'unix' (LF only). 
"default_line_ending": "system"
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.