Build failed when following the instruction to deploy the sample django app

I am new to render and trying to manually deploy the sample django app by following the instruction: Getting Started with Django on Render | Render Docs
I haven’t created the django app on my local yet and it will be my next step after tring the deployment. I pretty much followed the section: “Deploy to Render” > “Manually Deployment”. The deployment failed with the error in the console:

psycopg/psycopgmodule.c: In function ‘add_module_types’:
  psycopg/psycopgmodule.c:921:36: error: lvalue required as left operand of assignment
           Py_TYPE(typetable[i].type) = &PyType_Type;
                                      ^
  psycopg/psycopgmodule.c: In function ‘datetime_init’:
  psycopg/psycopgmodule.c:953:30: error: lvalue required as left operand of assignment
       Py_TYPE(&pydatetimeType) = &PyType_Type;
                                ^
  psycopg/psycopgmodule.c: In function ‘PyInit__psycopg’:
  psycopg/psycopgmodule.c:1085:28: error: lvalue required as left operand of assignment
       Py_TYPE(&typecastType) = &PyType_Type;
                              ^
  psycopg/psycopgmodule.c:1088:25: error: lvalue required as left operand of assignment
       Py_TYPE(&chunkType) = &PyType_Type;
                           ^
  psycopg/psycopgmodule.c:1091:25: error: lvalue required as left operand of assignment
       Py_TYPE(&errorType) = &PyType_Type;
                           ^
  error: command '/usr/bin/gcc' failed with exit code 1
  
  at /home/render/.python-poetry/venv/lib/python3.11/site-packages/poetry/installation/chef.py:164 in _prepare
      160│ 
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│ 
      163│             if error is not None:
    → 164│                 raise error from None
      165│ 
      166│             return path
      167│ 
      168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:
Note: This error originates from the build backend, and is likely not a problem with poetry but with psycopg2-binary (2.8.5) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "psycopg2-binary (==2.8.5)"'.

Any hint about what I may miss?

I tried a couple of other build options without luck. Can someone give it a try?
I am trying out the “free version” now and see great potential compared to other cloud hosting solutions. I plan to use postgresql as well. Thanks!

Hello – thank you for raising this.

The issue was that the psycopg version in the example app was incompatible with Python 3.11, now Render’s default Python version.

I’ve updated dependencies in the Poetry lock file and was able to deploy the application successfully.

The latest changes should be available on the master branch in the repo GitHub - render-examples/django: Getting Started wth Django on Render Example.

Eric, thanks for the prompt response! I will check it out shortly.

Eric,
I just tried, the build and deploy went through. I got Server Error (500) when accessing from the browser. Here are some info:
my app: Render · The Easiest Cloud For All Your Apps
I followed the Getting Started with Django on Render | Render Docs with 3 envs. I was curious to check the code and noticed that the DATABASE_URL and WEB_CONCURRENCY are not referenced in the code and wondering if they are being used.
Thanks!
John

Hey John,

Your service logs may give you some hints about what is happening when you make the failing requests, I’d recommend to check the logs first. You’ll possibly need to raise the log level in your Django settings file though.

There are a few routes that lead to a 500 with Django but it’s generally a code issue where we’re limited in the amount of support we can provide. Please check out the following links to find potential solutions:

Jérémy.
Render Support, UTC+3

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