I just started using heroku today. I was testing a web application, and got different results on using django app from local development server and heroku. I had imported to the database by running the django development webserver. Since the postgredb uses the amazonaws url, I assumed that this data would be available to the production server on heroku.
From my local django webserver, the following search yields correct results:
from django.db.models import CharField
from django.db.models.functions import Lower
CharField.register_lookup(Lower, "lower")
import logging
logger = logging.getLogger('testlogger')
logger.info('This is a simple log message')
items_set = []
if request.method == 'POST':
print(request.POST.get)
form = CGHSMetaForm(request.POST)
name = request.POST.get('name').lower()
items_set = CGHSRates.objects.filter(
name__lower__contains=name).order_by('name')
print(items_set)
logger.info(items_set)
else:
form = CGHSMetaForm()
return render(
request, 'app/cghs_search.html', {
'rnd_num': randomnumber(),
'form': form,
'items': items_set,
})I get the following results:
Code
Name
Rate
1098
After Mastectomy (Reconstruction)Mammoplasty
Rs 13800.0
364
Local mastectomy-simple
Rs 14548.0
251
Mastoidectomy
Rs 17193.0On heroku, however, I receive an empty result.
The database is the default heroku database, a postgre db, defined by the following settings in settings.py:
import dj_database_url
DATABASES = {'default': dj_database_url.config(default='postgres://kpnbcpyqtxxjqu:2c86exffsdff0d789e7f3b29d7...@ec2-53-22-46-10.compute-1.amazonaws.com:5432/dful1l3ra7nknn')}Why does the same database when accessed on different servers yield different results? What should I be checking?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA%3Diw__mSiZvrTZTrraLB4jq-kiFvm7Qkr0B6D%2Bffa2w4J-rkg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAOyh6%3DLOgkE14V6Ey1P41P_B5mG9qi%2BF%2Bf%3DCnxa1q-8eXtsO%2Bg%40mail.gmail.com.