Live data from Hacker News

Portable Django

djngo.com

21–30 of 71 posts

Re: Portable Django

#21
post #8

Why?

djngo.com is the culmination of years of effort, creating a single file python executable that runs on all platforms. This project is based on APE ( https://justine.lol/ape.html ) and in the past few days, our Python APE port (called python.com) became good enough to run Django. So we put Django inside the executable too, and called it djngo.com. The djngo.com executable will just work on the following platforms: - A…

[deleted]

Re: Portable Django

#22
I'm getting the wrong hash when I download the file (I tried a couple times).

I'm running

    curl -O https://djngo.com/djngo.com
    shasum -a 256 djngo.com
and I get

    6133a4f5c76af6ca6a2b2eba115783a78fc1721cd384539076884f640b801a26  djngo.com
I'm on a M1 Mac. Am I missing something obvious?

I tried running it anyway (smart I know) and it failed with

    zsh: exec format error: ./djngo.com

Re: Portable Django

#24

I'm getting the wrong hash when I download the file (I tried a couple times). I'm running curl -O https://djngo.com/djngo.com shasum -a 256 djngo.com and I get 6133a4f5c76af6ca6a2b2eba115783a78fc1721cd384539076884f640b801a26 djngo.com I'm on a M1 Mac. Am I missing something obvious? I tried running it anyway (smart I know) and it failed with zsh: exec format error: ./djngo.com

Please try again, I just re-ran the deployment and tested on my M1 (OSX):

  x@m1n1n0 ~> chmod +x djngo.com   
  x@m1n1n0 ~> sha256sum djngo.com   
  6205984f572575c407ce65502361b554af17584f076076bec7440613459d  1dff  djngo.com
  x@m1n1n0 ~> ./djngo.com 
  extracting blink-darwin-arm64 to /var/folders  /fn/4cdpvwcx1wnc53rzl2m0pn_m0000gn/T//.ape-blink-0.9.2
  Python 3.6.14+ (Actually Portable Python) [GCC 9.2.0] on cosmo
  Type "help", "copyright", "credits" or "license" for more   information.
  >>:

Re: Portable Django

#25
post #23

Are people still using Django?

A lot. And it baffles me why hasn't anyone realized that Kenneth Reitz was right about django over a decade ago and all his points are equally valid today. https://speakerdeck.com/kennethreitz/flasky-goodness

Flask FTW.

Re: Portable Django

#27
post #23

Earlier quoted context omitted.

A lot. And it baffles me why hasn't anyone realized that Kenneth Reitz was right about django over a decade ago and all his points are equally valid today. https://speakerdeck.com/kennethreitz/flasky-goodness

Flask FTW.

If you like Flask (I do too), you can do what we used to do before Flask existed (./djngo.com -p project runserver) where .python/project.py in the zip is:

  import os
  from django.conf import settings
  from django.core import management
  from django.conf.urls import url
  from django.http import HttpResponse

  # Django 2.2 Release Notes
  # https://docs.djangoproject.com/en/4.1/releases/2.2/
  # Documentation
  # https://docs.djangoproject.com/en/2.2/

  __version__ = 0.1

  DEBUG = True
  ROOT_URLCONF = 'project'
  DATABASES = {'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'project.db' }}
  SECRET_KEY = os.getenv('SECRET_KEY', 'Please set a SECRET_KEY as an env var.')

  if not settings.configured:
    settings.configure(**locals())

  def index(request):
    return HttpResponse('Hello Django!')

  urlpatterns = [
    url(r'^$', index),
  ]

  if __name__ == '__main__':  # pragma: no cover
    management.execute_from_command_line()

Re: Portable Django

#29
Hmm, this has me thinking I could build a single-file executable with a self-contained database or that connects to the server. And with a little work I might be able to launch the system browser pointed at the Djngo. And with this I might have a simple web based replacement for all the Access utilities floating around here?

I know about Electron and Tauri and all that but this seems like an intriguing possibility to work on.

Re: Portable Django

#30
post #29

Hmm, this has me thinking I could build a single-file executable with a self-contained database or that connects to the server. And with a little work I might be able to launch the system browser pointed at the Djngo. And with this I might have a simple web based replacement for all the Access utilities floating around here? I know about Electron and Tauri and all that but this seems like an intriguing possibility to…

If you don't mind Lua, then redbean already has you covered:

https://redbean.dev/

Post reply on HN