What I love about Django is that you can create a Django project with just one file. You can turn a fresh Debian machine into a running Django web app by just doing: apt install -y python3-django apache2 libapache2-mod-wsgi-py3 And then creating the one file Django needs: /var/www/mysite/mysite/wsgi.py: import os import django from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MO…
Blown away this is possible. When I was starting to learn to code and was overwhelmed when learning all the bits and pieces of rails, I wondered if everything necessary to run a very small app could be placed in a single file. I guess this is the answer, but in python/django instead of ruby/rails. It would be a fun exercise in ruby/rails too (not totally sure if it's possible, but suspect it may be, albeit probably r…
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '~> 7.1'
gem "sqlite3", "~> 1.4"
end
require 'rails'
require 'active_record/railtie'
database = 'app_development.sqlite3'
ENV['DATABASE_URL'] = "sqlite3:#{database}"
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: database)
ActiveRecord::Schema.define do
create_table :my_table, force: true do |t|
t.integer :my_table_id
end
end
class App
For very small apps on ruby land sinatra and roda are the right choices.
On python the choice would be flask instead of the single file django.