PostgreSQL on pythonanywhere.com - django

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

Related

Trouble deploying django webapp onto google cloud

I've been following the google cloud documentation titled, "Running Django on the App Engine standard environment" . I'm using the same app provided in the documentation in the "Cloning the Django App". Honestly, I get lost in the google cloud documentation under the "Configuring Database Settings" section. This what my settings.py (mysite/settings.py in the given app mentioned previously)
Mysite/settings.py img
Whenever running python manage.py makemigrations - I get the following error message on the CLI...
django.core.exceptions.ImproperlyConfigured: Set the SECRET_KEY environment variable
Also, I have noticed there is no .env file in that repo. Would I maybe have to create it myself or would is it fine? Again I am using the github given app via the documentation.
Just trying to deploy Django website to google cloud. Any help would be greatly appreciated. Im on Mac Big Sur btw if that matters.
I tried to deploy the application using this documentation and got the same error you mentioned about. Then I observed that there is some issue with the github files mentioned in the documentation for which an open github issue is there. The reason for the issue is that the current code in the github repository matches a new tutorial version and we hope to get the new tutorial version updated soon to match the current code in the github repository.
For now using a specific previous version of ‘mysite/settings.py’ file in place of the current ‘mysite/settings.py’ file and adding ‘PyMySQL==1.0.2’ in requirements.txt file will work. The required previous version of the ‘mysite/settings.py’ can be found in this link. Follow the documentation for all remaining steps.

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.

installing GeoDjango on Heroku

I am trying to build a webapp which uses GeoDjango. The app is to be hosted on Heroku, but I am facing issues in it. I am using this buildpack but then this error is coming. Figured out that this is happening because of Cedar 14 but I am not clear as to what should I do next.
Also I tried using this buildpack but as discussed here, this issue can be resolved by using the buildpath as
$ heroku config:add BUILDPACK_URL=https://github.com/cyberdelia/heroku-geo-buildpack.git#1.3
I tried the same but now it is not detecting it as a Python app and now I am facing the issue of "django import error - No module named core.management " missing, which is because its not installing Django.
Any help will be greatly appreciated.
I figured out the solution to this problem myself only.
To add multiple values for a BUILDPACK_URL, one needs to use a buildpack which can add support for mutiple BUILDPACK_URL.
So I used this. One can write like
$ heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
After this create a file .buildpacks and add to it the following
https://github.com/cyberdelia/heroku-geo-buildpack.git#e1b845b
https://github.com/heroku/heroku-buildpack-python.git
Note that #e1845b is because of this comment, which mentions that it is because of some caching issues.

Django CMS Deployment issues using Apphooks with Postgresql

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

Deploying django project on AWS elastic beanstalk

I am following the tutorial for deploying a django project on AWS elastic beanstalk here:
http://docs.amazonwebservices.com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html
My app works when I test locally but when I deploy, I'm getting a 404 error. Looking at the event logs, I see this message:
Error running user's commands : An error occurred running '. /opt/python/ondeck/env && PYTHONPATH=/opt/python/ondeck/app: django-admin.py syncdb --noinput' (rc: 127) /bin/sh: django-admin.py: command not found
That leads me to believe that the tutorial is missing a part about installing django files on the server or at least configuring my project to recognize django-admin.py. I have django installed on my local machine so it works there.
I know python support is brand new for elastic beanstalk but has anyone deployed django to it?
I believe you don't need to put container_commands in .config because there is no database or table at this moment.
Did you made the step?: Freeze the requirements.txt file.
(djangodev)# pip freeze > requirements.txt
Note
Make sure your requirements.txt file contains the following:
Django==1.4.1
MySQL-python==1.2.3
I had the same problem because I skipped it. Once I did it, add, commit and push. It works!
I followed the same tutorial recently and had a similar result.
At step 6, upon seeing the default django 'congrats' page render locally, I deployed to EB as instructed and got a 404 instead of the default 'congrats' page.
I decided to use the code up to that point as a foundation for following the 'getting started with django tutorial' which led me to a successful rendering of a 'home' view. This is a much more useful place to be anyway. I do agree that there is something wrong with the AWS tutorial and posted to the AWS forums here.
If you can, you should try to access the log file; it might give you a better idea of what's going on. Here's a link that might help:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.loggingS3.title.html