Django CMS Deployment issues using Apphooks with Postgresql - django

I am trying to run a Django CMS project that i created recently. The project uses PostgreSQL for its database, and works great with the runserver command.
But i started having intermittent Bad Gateway(Nginx) issues when i deployed the project using NGINX and WSGI. This error was sometimes happening on the whole site or sometimes in the sidebar where the pages, administration, etc would show up or sometimes in the page or advanced page settings.
The error i was getting was as follows:
django.db.utils.OperationalError: SSL error: decryption failed or bad record mac
So i decided to get into the details of the error and found out that this error occurs only when i am using AppHooks in the project and that too only with PostgreSql. The project worked well when i deployed it using Sqlite database.
I further tried to resolve the issue by setting ssl = false in the config. file of PostgreSql to see if that would change anything. It changed the error i was getting earlier as follows:
django.db.utils.InterfaceError: connection already closed
So i was wondering the reason behind this issue? Let me remind you that this error is happening only when the project is deployed and not when runserver is being used.
UPDATE:
I tried using the Django-debug-toolbar to check what sql queries are being executed during these errors and it turns out the app is working fine. Somehow the debug toolbar is slowing down the applications which is not breaking the app any more. What might be the reason for the app to not work? How can i get around this issue

Related

Getting really strange error when deploying a django app on Heroku

I tried to deploy my django application to heroku using the starter guide and the other manual that shows you to create your runtime, requirements, procfiles, installing django-heroku, etc. So I've now deployed my site but recieve the following error.My error I'm unsure of why this error is showing up at all especially when it worked perfectly fine locally. I haven't followed all of the django deployment checklist yet, such as setting DEBUG to False because I'd like to ensure that it works correctly before I do. If anyone could help me, that'd be much appreceiated!
You have to do migration after pushing to Heroku.
Note: Don't use local migrations. You can use Heroku bash to connect remotely and perform migrations just like you do locally.

Django 2.1.5 migration does not happen with makemigrations command

In our Django project(Django 2.1.5), every time we try to run the project we have to give the '--noreload' command in addition to the runserver command, else the project returns an error as,
ValueError: signal only works in main thread
We are using Django signals to communicate between the apps created in Django and Web-sockets in Threading aysnc-mode to connect between the other services involved in the project. When we try to deploy the project in Jenkins, this becomes a problem and we are using Nginx as the webserver for host the application. Is there any possibility to solve the issue of '--noreload' and run the application normally?
We are not sure if its because of the same problem referred above but we have a problem when trying to migrate the changes in the Models in Django, it always returns
No changes Detected
After a quick internet search, we did the migrations by mentioning the app names and it did work, yet the terminal stays still after the migrating and waits to manually terminate the process.
Is there a possible solution to overcome this? and also we would like to know where we go wrong

PostgreSQL on pythonanywhere.com

Please i used the django-girls django tutorial created my first django project but used postgreSQL database instead and i pushed it to my repository on github. I tried to host it on pythonanywhere.com but i got an error. I researched on the error and found out that i have to upgrade to a paid account to use postgreSQL. I deleted the repository from github and even started the django project again this time using the default SQLlite3 and then i pushed it to github. When i tried to push it to pythonanywhere.com, i got the same postgreSQL error. Please i want to know how i can change the database back to SQLlite3 because pythonanywhere.com is still recognising the postgreSQL. I hope my question is understood. Thanks

Trying to set Django and postgreSQL on Heroku

I'm trying to follow the Heroku tutorial on deploying Django applications:
Getting Started with Django on Heroku
I'm able to run most of it without problems, but when it comes to synching the postgreSQL database I'm getting the following message:
psycopg2.OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
I've tried promoting databases,
seting the HOST to /tmp,
modifying the postgresql.conf,
and many other stuff I found searching around without success
I'm working on MB-Pro, Mac OS 10.7 (Lion), and read in some places that this OS was giving developers some headache when it comes to postgre. Did anyone have this problem on OS 10.7, and had it fixed after updating to 10.8? I'm considering updating in case it solves the problem.
Thank's in advance.
EDIT:
The command I'm trying to run is: heroku run python manage.py syncdb
EDIT:
I forgot to delete the DATABASE definition that was already defined on the file.
I made use of the PostgresApp to help with running Postgres on my Mac and then in a terminal ran;
psql -h localhost
I forgot to delete the DATABASE definition that was already defined on the file. It's working now.

djapian based search freezes

When I try to run a djapian based search it freezes the applications and I dont get any response from the server. Am deploying the site using mod_wsgi. The search runs fine when i run it in the python shell or in the django dev server. The problem seems to arise only when I deploy my site to apache. Does anyone know how I can get around this issue?
I ran into the same problem when I started using Djapian. You should be able to work around this problem by adding the following to your Apache site
configuration file:
WSGIApplicationGroup %{GLOBAL}
More information on the subject is available here: http://trac.xapian.org/ticket/185 and there's a related ticket for Djapian here: http://code.google.com/p/djapian/issues/detail?id=35