Migration from heroku to Render failed

Hello!
I’m trying to migrate a Django project hosted on Heroku using Blueprint.
I’m following these steps:

When I try deploying I get this error:

/render/build-scripts/apply-buildpacks.py: No such file or directory

How could I fix it?

Hey Lucas,

Seems like we had a problem replying on your original post, hopefully this one works. On your original post I responded with:

I suspect you may have an error higher up in the deploy output that may indicate what the cause is

John B

Yes! Thank you for your feedback!
Higher up in the output is returned this error:

But I specified in the render-buildpacks.json:

{
  "buildpacks": [
    "heroku/python"
  ]
}

Then, also, appears some issues:

Nov 11 07:41:07 AM  #9 0.122 Could not find a 'project.clj' file! Please ensure it exists and is checked into Git.
Nov 11 07:41:07 AM  #9 0.125 Python
Nov 11 07:41:07 AM  #9 0.126 fatal: not a git repository (or any of the parent directories): .git
Nov 11 07:41:07 AM  #9 0.150 -----> No Python version was specified. Using the buildpack default: python-3.10.5
Nov 11 07:41:07 AM  #9 0.150        To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes

Regarding unespecified Python, I set an environment variable setting Python to 3.7, but the message continues.

Thanks already for the feedback. If you could help me debug I’d much appreciate.

Hi Lucas–I handle CLI and heroku-import stuff here at Render.

I can’t reproduce your problem, but it’s sounding like some sort of super weird versioning error. It’s trying to run nodejs and Clojure (?) buildpacks for you, but your .render-buildpacks.json file doesn’t have them in it.

Could you verify a couple things for me:

  • It’s .render-buildpacks.json, not render-buildpacks.json as you literalized it in your last message?
  • If so, can you verify that the import ran with the latest version of the Heroku importer? Does it work then?
  • If it works then, what happens when you do docker build -f Dockerfile.render . on your local?
  • And if that doesn’t work, could you email your Dockerfile.render and your .render-buildpacks.json as attachments to ed@render.com?

Thanks!

Hello @eropple ! Thanks for your input!
Regarding your questions:

  • The name is .render-buildpacks.json as you said it. Sorry for the confusion.
  • I’m running @renderinc/heroku-import 4.0.0. It’s the latest according to this.
  • After executing the docker build -f Dockerfile.render ., I got following error message:
 => ERROR [builder 3/3] RUN /render/build-scripts/apply-buildpacks.py heroku-22                                                                              0.6s 
------
 > [builder 3/3] RUN /render/build-scripts/apply-buildpacks.py heroku-22:
#9 0.545 Traceback (most recent call last):
#9 0.545   File "/render/build-scripts/apply-buildpacks.py", line 159, in <module>
#9 0.545     raise Exception(err_msg)
#9 0.545 Exception: bin/detect failed for '/render-build/cache/cache/heroku/python'.
#9 0.546  - heroku/python
#9 0.546     - preinstalled buildpack detected
#9 0.546  - 1 buildpacks resolved.
#9 0.546     - /render-build/cache/cache/heroku/python
------
executor failed running [/bin/bash -c /render/build-scripts/apply-buildpacks.py ${HEROKU_STACK}]: exit code: 1

Thank you so much for all the help!

Hey Lucas–

Thanks for sending those over. I’ll look at them ASAP, but that you’re getting this error suggests to me that you’re getting a works-as-intended result because /bin/detect can’t find a requirements.txt file. Django uses pyproject.toml these days, I know, but the Heroku buildpack doesn’t seem to understand how to parse that. (I am not a Python user, so this is me mostly going through and trying to reverse engineer things.)

I did find this script that demonstrates how to convert pyproject.toml into a requirements.txt file; if it works (run it, then re-run Docker locally), you could add it to your Dockerfile.render before the apply-buildpacks.py line so you don’t have to keep a requirements.txt file in your repo (or you can manually manage it, your call).

Alternatively, you might be better off using a Python native environment, which understands Poetry/pyproject natively. Native Environments | Render · Cloud Hosting for Developers Converting over your render.yaml should only be a couple of lines, and doable if you don’t have non-Python buildpacks in your Heroku stack.

If you go that route, somebody from Support may be able to help you more concretely, so I’ll ping @John_B to review this thread on Monday (he’ll see it before I will).

-Ed

Hello guys!
Thanks for all your support! This is a great community!

So I quit trying to do this via Heroku and Blueprint. Instead I tryed the alternative suggested by @eropple. I followed this guide to deploy a django project.

I manage to deploy the project successfully but, when I access the website’s link, I get Server Error (500).

https://prontuarioafr.onrender.com/login/

Can we discuss it in this thread or should I open another one?

Anyway, I don’t know what’s going on. Could use some help?

Regards! You guys have been awesome!

Hello guys!

Just one update…

I saw another post in the Render Community with similar problem.

I noticed that the admin page was loaded successfully! So I tried changing the project to DEBUG and it worked! Very happy about it!

I still don’t know what’s the problem with DEBUG flag. In my project, the difference beetween DEBUG and not DEBUG are the following:

DEBUG
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static'), ]

NOT DEBUG

STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

If you have any input on why it doesn’t work with NOT DEBUG settings, I would appreciate a reply.

But, by all means, I’m satisfied with the working deployed application, with Render product and its community.

Thank you so much!

For those whom may have the same problem (Server Error 500).
I discovered why it happended.
The variable ALLOWED HOST was set like this based on the tutorial mentioned.

ALLOWED_HOSTS = []
RENDER_EXTERNAL_HOSTNAME = os.environ.get('RENDER_EXTERNAL_HOSTNAME')
if RENDER_EXTERNAL_HOSTNAME:
    ALLOWED_HOSTS.append(RENDER_EXTERNAL_HOSTNAME)

So it was getting a allowed host from a environment variable RENDER_EXTERNAL_HOSTNAME that wasn’t setted up.

I just add a variable:

RENDER_EXTERNAL_HOSTNAME = https://prontuarioafr.onrender.com

Hope this helps! I’m tagging the thread as solved.

Regards!