Django inernal server Error - django

I'm working on a Django website.
When I upload an image and its name is in English, it will be uploaded. But when I try to in Arabic it can't upload, it gives an internal server error.

I think you got unicode error in server.
So set both in system environment then check.
LANG='en_US.UTF-8'
LC_ALL='en_US.UTF-8'
https://code.djangoproject.com/wiki/django_apache_and_mod_wsgi#AdditionalTweaking

Related

django-rest-framework-social-oauth2: error 400 - redirect_uri_mismatch

I've been trying to add google login to my django app following this tutorial:
https://github.com/RealmTeam/django-rest-framework-social-oauth2
By following exactly the instructions, everything works fine in local.
However, when I try to replicate the same on the server, I get the following error on the redirect page of the login:
Error 400: redirect_uri_mismatch
redirect_uri: http://localhost:8000/auth/complete/google-oauth2/
What is strange to me is, in my google developer console, I have set up the correct redirect url in my app, as follows:
https://mydjangoapp.com/auth/complete/google-oauth2/
And I have also put 'mydjangoapp.com' under 'Authorised JavaScript origins'.
So my question is, why google keeps telling me that the redirect url is
http://localhost:8000/auth/complete/google-oauth2/
which is not the one I have set up in the console? Perhaps there is something obvious that I'm missing here. Thank you!
Why google keeps telling me that the redirect url is
Because your application is sending its in your code the app is running on http://localhost:8000 and if you are using a client library its probably adding the rest automatically.
http://localhost:8000/auth/complete/google-oauth2/
The redirect uri must exactly match what you are sending from your application.
You need to add
http://localhost:8000/auth/complete/google-oauth2/
Javascript origin is only needed if your code is using javascript.
This video will show you how to fix the error. Google OAuth2: How the fix redirect_uri_mismatch error. Part 2 server sided web applications.
If you want your code to send https://mydjangoapp.com then your going to have to be running it from https://mydjangoapp.com probably and you may need to figure out how to configure it so that it is running from the correct host.

getting 500 Internal Server Error when hosting website on cyberpanel

I am hosting django application on Cyberpanel. I have created website in cyberpanel and setup my django project. also changed vHost configuration. but in LIST WEBSITES getting this error
No Screenshot Available
500 Internal server Error
here is image
I cant figure out how do I get rid of it
Cyberpanel is using Statically's services to generate screenshots, it seems something wrong with Statically's server. Don't worry, it's not your Cyberpanel's problem.
Statically.io:
https://statically.io/
Demo: (Not working)
https://cdn.statically.io/screenshot/google.com

UTF-8 encode error when configuring Sentry Addon to Heroku app

I am trying to configure Sentry addon on Heroku and I get an error
Encoding error. Please ensure that all data in the request can be interpreted as UTF-8.
I tried both command line and using the dashboard in the browser. I have checked my account settings and don't use any non - English characters.
As noted by Markus Unterwaditzer in the notes to the question, it seems it was an issue with Sentry. I can now confirm that it works.

Error occurred while generating PDF in Coldfusion using cfhtmltopdf

I am getting the following error using cfhtmltopdf:
Error occurred while generating PDF. Reason: PDF conversion is failed due to timeout. Increase the timeout value in PDFgService manager settings.
According to these docs (see "Configuring the PDF service manager"), I should be able to tweek the PDF Service Settings in the web.xml file:
https://helpx.adobe.com/coldfusion/pdf-generation-in-coldfusion.html
On Production, I am able to find the file and make these changes. It is located here:
//jetty/webapps/PDFgServlet/WEB-INF/.
However, locally, using CF2018 Developer Edition using IIS Server Mode, I cannot find any reference to any PDF service settings in any of the web.xml files in my CF directories. This folder also does not exist: //jetty/webapps/PDFgServlet/WEB-INF/.
I did find locally this folder:
C:\ColdFusion2018\cfusion\hf-updates\hf-2018-00003-314033\jetty\webapps\PDFgServlet\WEB-INF
There was no web.xml file there though, and adding one in with the settings had no effect (after restarting CF).
So I'd like to know how does one change these PDF settings in a local/development environment like this, like I was able to do on Production, in order to further debug this error I am getting.
UPDATE: We have logged the underlying issue with Adobe: https://tracker.adobe.com/#/view/CF-4208624

Add multiple hostnames to .env file for Django

I have created a Django project using Django Cookiecutter with Docker.
So far so good, but I keep getting a 400 error (Bad request).
When I look in the log on Sentry, I can see the message that I need to add the ip address 123.123.123.132 to allowed hosts.
In .env there is a variable DJANGO_ALLOWED_HOSTS, which by default contains the domain name that was entered when using Cookiecutter.
Some ways I have tried so far:
DJANGO_ALLOWED_HOSTS=.foo.bar,123.123.123.132
DJANGO_ALLOWED_HOSTS=.foo.bar 123.123.123.132
DJANGO_ALLOWED_HOSTS=[.foo.bar,123.123.123.132]
What syntax should I use here to make this work?
Thanks
From the Django documentation
You should try
ALLOWED_HOSTS = [".foo.bar" , "123.123.123.132"]