VS Code is an ideal choice when it comes to development activities and for Python / Django there are few other tools that can barely match the functionalities provided by VSCode.
VS Code by default comes with Django server , which is ideal for development activates.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Django",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver"
],
"django": true,
"autoStartBrowser": false
}
]
}
However when django is published as production site and SSL encryption is activated , the above mentioned option will give a SSL certificate error since internal django test server will render HTTP and with production HTTPS setup SSL certificate error will be issued.
Secure Connection Failed
An error occurred during a connection to 127.0.0.1:8000. SSL received a record that exceeded the maximum permissible length.
Error code: SSL_ERROR_RX_RECORD_TOO_LONG
The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
Please contact the website owners to inform them of this problem.
Learn moreā¦
The only option to overcome this error is to run the server in a different port. to run server in a different port modify launch.json file with the open port. This will run the server in the port mentioned in the launch.json file without any error.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Django",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver",
"127.0.0.1:8085"
],
"django": true
}
]
Any port can be added and when debugged with VSCode with this launch.json file code can be debugged.
If debugging is not required , test server can be initiated with the following command python manage.py runserver 8090
0 Comments