3đź‘Ť
I think you should just create an application that connects to the webserver. There is a good answer to getting RESTful API calls into your django application. This means you’d basically just be creating a new front-end for your server.
It doesn’t make sense to rewrite the entire django application as a desktop application. I mean, where do you want to store the data?
2đź‘Ť
For starters, you’ll have to replace the web UI with a desktop technology like Tk/Tcl.
If you do that, you may not want to use HTTP as the protocol between the client and the services.
Django is a web framework. If you’re switching to a desktop, you’ll have to forego Django.
- [Django]-Use context processor only for specific application
- [Django]-Django URL Config – Match filename
- [Django]-Ngnix – duplicate upstream "app_server" in /etc/nginx/sites-enabled/django
- [Django]-Docker-compose ERROR [internal] booting buildkit, http: invalid Host header while deploy Django
- [Django]-How should I upgrade from bradjasper's django-jsonfield to Django's built-in jsonfield?
2đź‘Ť
I would try to replicate the Django application functionality with the PyQt toolkit.
You can in fact embed web content in PyQt applications, with the help of QtWebKit. I would post some potentially useful links, but apparently I have too low a reputation to post more than one 🙂
2đź‘Ť
It is possible to convert a django application to a desktop app with pywebview with some line of codes. Frist create a python file gui.py in directory where manage.py exists. install pywebview through pip, the write the code in gui.py
import os
import sys
import time
from threading import Thread
import webview
def start_webview():
window = webview.create_window('Hello world', 'http://localhost:8000/', confirm_close=True, width=900, height=600)
webview.start()
window.closed = os._exit(0)
def start_startdjango():
if sys.platform in ['win32', 'win64']:
os.system("python manage.py runserver {}:{}".format('127.0.0.1', '8000'))
# time.sleep(10)
else:
os.system("python3 manage.py runserver {}:{}".format('127.0.0.1', '8000'))
# time.sleep(10)
if __name__ == '__main__':
Thread(target=start_startdjango).start()
start_webview()
then run gui.py with the command python gui.py. IT will create a window like desktop app
- [Django]-Django with django-nose: two identical settings files with different behavior in running test command
- [Django]-How to escape a single quote within trans when the line is already wrapped with single quotes?
- [Django]-Validation Error with Multiple File Uploads in Django via Ajax
- [Django]-Django, a problem about zip file response
- [Django]-Django Authenticate Backend Multiple Databases
1đź‘Ť
There are two places you can go to try to decouple the view and put it into a new desktop app. First you can use the existing controller and model and adapt a new view to that. Second, you can use only the existing model and build a new view and controller.
If you haven’t adhered closely enough to the MVC principles that you can detach the model from the rest of the application, you can simply rewrite the entire thing. if you are forced to go this route, bail on django and http entirely (as duffymo suggests above).
You have to also evaluate these solutions based upon performance requirements and “heaviness” of the services. If you have stringent performance requirements then relying on the HTTP layer just gets in the way, and providing a simple API into your model is the way to go.
There are clearly a lot of possibly solutions but this is the approach I would take to deciding what the appropriate one is…
0đź‘Ť
There’s a project called Camelot which seems to try to combine Django-like features on the desktop using PyQt. Haven’t tried it though.
- [Django]-Add CSS class to django RadioSelect label
- [Django]-How to install mod_wsgi on Windows+XAMPP in 2017
- [Django]-Django problem with extends template tag
- [Django]-How to output SQL generated by Django Admin
0đź‘Ť
I am thinking about a similar Problem.
Would it be enough to habe a minimal PyQt Gui that enables you to present the djando-website from localhost (get rid of TCP/HTTPS on loop interface somehow) via QtWebkit?
All you seem to need is to have a minimal Python-Broser, that surfs the build in Webserver (and i guess you could even call Django directly for the html-payload without going over the HTTP/TCP layers).
- [Django]-MS Access backend for django
- [Django]-Django-pyodbc-azure – How to use schemas
- [Django]-ImportError: No module named south
- [Django]-Formatting inline many-to-many related models presented in django admin
- [Django]-How install a extension in postgresql before creating the models in django?
0đź‘Ť
I have django manage.py runserver
in .bat file and a localhost bookmark bar in a browser and whola a django-desktop-app. Or make your own browser that opens localhost. Creating a web-browser with Python and PyQT
- [Django]-SIGWINCH ignored. Not daemonized
- [Django]-How use python-docx to stream a file from template
- [Django]-Django_crontab not working on production docker
- [Django]-Embed an external link in django app
- [Django]-Django objects.get()