django-quick-start icon indicating copy to clipboard operation
django-quick-start copied to clipboard

template does not work out of the box: `django.core.exceptions.ImproperlyConfigured: Missing connections string` error

Open swyxio opened this issue 6 years ago • 9 comments

Here is a deployed version of this template: https://django-test-9g3f.onrender.com/accounts/login/ and if you try signing up and logging in you get a 500 error.

image

I reported this in slack, filing for others in future to follow up https://render-community.slack.com/archives/CH85FC7PY/p1580795055217400

I'm not a Django user at all, was just kicking tires, so unfortunately I dont really know what the root cause is. @anurag says it is an issue with Django redis, but it exists in base.txt. I added it in my fork just to be extra sure but still see this same error.

swyxio avatar Feb 07 '20 21:02 swyxio

Thanks! We'll investigate.

anurag avatar Feb 08 '20 01:02 anurag

Thanks! We'll investigate.

Hi, I am facing the same problem as of Mid-March 2020. The user signing up and logging in process doesn't work for the demo. I am able to log in using the superuser though.

gpalrepo avatar Mar 20 '20 03:03 gpalrepo

+1 - Same problem here; @anurag Is there a workaround for this one? image

gwiskur avatar Mar 23 '20 16:03 gwiskur

fyi @gpalrepo @gwiskur my workaround was to just setup django from scratch and overwrite this repo. you can still do that under the Render free tier.

swyxio avatar Mar 25 '20 22:03 swyxio

@sw-yx Thanks for the reply! I setup a new django-cookiecutter project from scratch, and that worked for me as well.

It wasn't obvious to me at first, but the root of this "Improperly Configured" issue was probably that REDIS_URL wasn't specified as one of my environment variables; it is used in the production settings file here: https://github.com/render-examples/django-quick-start/blob/8a3374812ddd93a689c32732c4311dfc1d57d847/config/settings/production.py#L22

If you don't already have a Redis cache, you can use RedisLabs for a hosted solution, but there are many others; any of them should provide you with the url you would need once they are setup.

This is more of an issue with how to configure django-cookiecutter than with how to use Render. It would be a good idea to note that the REDIS_URL should be in the environment variables in the Render/django docs; With that update, this issue could probably be closed.

gwiskur avatar Apr 03 '20 21:04 gwiskur

Thanks @sw-yx and @gwiskur we have this in our docs: You can also create a new Redis instance on Render and add the REDIS_URL environment variable to use Django’s cache framework located here: https://render.com/docs/deploy-django. Feel free to re-open the issue if you think we can make the docs clearer to address this issue.

joshi4 avatar Apr 26 '20 00:04 joshi4

i'll just be real with you - imo this quick start isnt the best demo to try out django on render. i dont want to set up a separate redis instance just to try out a thing. ideally the whole thing ought to be self contained in a single service. but that really is just me, and im a frontend guy who doesnt know redis well. just tossing my 2c in.

all the best

swyxio avatar Apr 26 '20 20:04 swyxio

A few notes on this because it solved my own issue. This is my understanding

  1. The problem is with REDIS_URL not being configured, which is a simple fix if you have redis running. I spun up a free redis DB on redislabs as suggested here. (Note, the url will be redis://[endpoint]:[port].
  2. The free version of Render allows for 2 services/DBs but with psql, django, and redis (if running on Render), this makes 3.
  3. The current docs located at https://render.com/docs/deploy-django don't use cookiecutter, while the live example is built on cookiecutter (https://django.onrender.com/).

@joshi4 lots of love for maintaining this demo. A few things would help here though

  1. Updating the docs to use cookiecutter.
  2. Indicate the configs and settings to choose when building the repo through cookiecutter (specifically how to avoid redis so this still fits under the free tier).

Is there a way I can help out with this?

coreygarvey avatar Aug 23 '20 21:08 coreygarvey

Hi @coreygarvey thanks for highlighting these issues.

The docs https://render.com/docs/deploy-django here refer to https://github.com/render-examples/django and not this repo.

Given the similar names and the fact that this repo is pinned I can see how it can lead to confusion.

To mitigate the issue: I've unpinned this repo and pinned the new django repo.

https://django.onrender.com points to a django site created from this old repo. The new one can be found at: https://mysite-gcqq.onrender.com/ . We will update the django.onrender.com url to point to the demo created from https://github.com/render-examples/django soon.

Let me know if I missed addressing a particular issue.

joshi4 avatar Aug 24 '20 19:08 joshi4