Hacker News - New Comments: "django"https://news.ycombinator.com/newcommentsHacker News RSShttps://hnrss.org/hnrss v2.1.1Fri, 29 Mar 2024 11:04:34 +0000<![CDATA[New comment by ciwolex in "Show HN: A Django package to override and customize the default Group model"]]>This is great. Adds something that's missing in Django

]]>
Thu, 28 Mar 2024 14:55:11 +0000https://news.ycombinator.com/item?id=39852374ciwolexhttps://news.ycombinator.com/item?id=39852374https://news.ycombinator.com/item?id=39852374
<![CDATA[New comment by yuppiepuppie in "Ask HN: Who's getting their job applications rejected?"]]>Ha! Just got rejected from a process in the EU (not desperately looking) cause of a super nit picky coding challenge project. The project worked exactly to spec, I just overlooked the use of a third party package on a (Django) DB model to replace the "created_at" field.

Oh well! My 4 hours of coding was not totally a waste.

]]>
Thu, 28 Mar 2024 14:01:08 +0000https://news.ycombinator.com/item?id=39851580yuppiepuppiehttps://news.ycombinator.com/item?id=39851580https://news.ycombinator.com/item?id=39851580
<![CDATA[New comment by infamia in "How (and why) to run SQLite in production"]]>Setting SQLite PRAGMAs via Django settings was recently merged. I would expect to see this show up in the next version or two of Django.

https://code.djangoproject.com/ticket/24018

With the proper PRAGMAs set and modern hardware, you can do 400+ writes/sec with 4 uvicorn workers and ~100 clients connected. The achilles heal is writing lots of large files. That will cause concurrent requests to wait around for the disk to finish writing to the WAL.

]]>
Wed, 27 Mar 2024 17:19:38 +0000https://news.ycombinator.com/item?id=39841944infamiahttps://news.ycombinator.com/item?id=39841944https://news.ycombinator.com/item?id=39841944
<![CDATA[New comment by ahmedfromtunis in "Flatpak builds are not reproducible and why that's a practical problem (2022)"]]>I use Snap frequently, and yes, apps that would only take 10 mb as a .deb can balloon to 200 mb.

But I can live with that; it's a reasonable price to pay for separating apps update cycles from that of the OS.

I also use Docker. But even then, my Django app — complete with pytorch, numpy and several other "heavy" deps on top of python itself — is a little more than 400 mb.

Flatpak is on another level by itself!

]]>
Wed, 27 Mar 2024 16:33:14 +0000https://news.ycombinator.com/item?id=39841365ahmedfromtunishttps://news.ycombinator.com/item?id=39841365https://news.ycombinator.com/item?id=39841365
<![CDATA[New comment by mannders in "Show HN: DeploySolo – The SaaS boilerplate for engineers. (Pocketbase/ Htmx)"]]>Simply put, I found deploying a Django app on an EC2 instance to be a huge pain. Getting letsencrypt certs through nginx, setting up routes to a unix socket, choosing between WSGI and ASGI. Docker compose can help orchestrate these processes more easily, but its still a non-trivial amount of complexity. This isn't a documentation problem, but a personal distaste for the architecture.

This is the problem your first quote actually solves. I didn't fabricate a fake problem, I felt a real one.

Deploying a pocketbase application is as simple as getting a binary on a server with a HTTPS configured firewall, and giving it a domain name. I launched both deploysolo.com and deploysolodemo.com in a tmux instance, which isn't a great permanent solution, but a testament to ease of deployment for a market validation phase.

The "for engineers" generally comes from the fact that many web software engineers enjoy the Go ecosystem, and they can take a lot of their expertise creating HTTP routes into a SaaS boilerplate that solves common problems out of the box. Reinventing the wheel sucks when you have a business idea to get out into the world.

Anyway truly thank you for the feedback, I'm still learning and not trying to use grandiose language to extract money. I'm just trying my best to create something that helps people create their own value.

]]>
Wed, 27 Mar 2024 15:55:24 +0000https://news.ycombinator.com/item?id=39840899manndershttps://news.ycombinator.com/item?id=39840899https://news.ycombinator.com/item?id=39840899
<![CDATA[New comment by biddit in "Claude 3 beats GPT-4 on Aider's code editing benchmark"]]>> The larger context window (200k tokens vs ~16k)

Just to add some clarification - the newer GPT4 models from OpenAI have 128k context windows[1]. I regularly load in the entirety of my React/Django project, via Aider.

1. https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turb...

]]>
Wed, 27 Mar 2024 14:17:39 +0000https://news.ycombinator.com/item?id=39839450biddithttps://news.ycombinator.com/item?id=39839450https://news.ycombinator.com/item?id=39839450
<![CDATA[New comment by anonzzzies in "Explorative Programming"]]>This is what Lisp is good at; emacs/slime and you can experiment/plan your project together. Python tries this with it's only repl (see the Django comment also; that solution works ok, but nothing compared to slime) or with notebooks and stuff. It's far behind though and I would much rather forever just use emacs/slime for everything. I do for my own projects, but for others I have to cry in my soup.

]]>
Wed, 27 Mar 2024 10:29:45 +0000https://news.ycombinator.com/item?id=39837389anonzzzieshttps://news.ycombinator.com/item?id=39837389https://news.ycombinator.com/item?id=39837389
<![CDATA[New comment by usernamed7 in "Show HN: DeploySolo – The SaaS boilerplate for engineers. (Pocketbase/ Htmx)"]]>My biggest complaint is that your copy (here, and on the site) uses delusional and grandiose language. Which shows me that you're just full of it. And surprise: people don't buy from people they don't trust.

and then there's this BS from the site:

>Its core, written in pure Golang, is of exceptional quality. Golang is esteemed for its productivity, simplicity, safety, and portability. With Pocketbase, your app—including public files—can be compiled into a single static binary deployable on any server, epitomizing true vendor independence.

The only thing this epitomizes is a solution in search of a problem.

Also from the site:

> Frameworks like Django and Rails offer pre-packaged solutions for common issues such as user authentication and template rendering, liberating developers to concentrate on solving business problems. They’re great for indie developers and integrate well with HTMX. However, there’s a caveat: over time, your expertise may become confined to the Python or Rails ecosystems.

What is this dribble? So the large and well documented python/rails ecosystems are bad, but using a boilerplate written by some guy is somehow better?

It's cool that you built something. It's absurd that you're trying to sell it to developers as "the SaaS boilerplate for engineers".

It is clear you do not understand the audience you are trying to sell into. You don't understand their pain, and you don't understand how they make decisions.

]]>
Wed, 27 Mar 2024 10:20:42 +0000https://news.ycombinator.com/item?id=39837321usernamed7https://news.ycombinator.com/item?id=39837321https://news.ycombinator.com/item?id=39837321
<![CDATA[New comment by deckiedan in "Explorative Programming"]]>My day job is Django - and the ipdb based `shell_plus` from the `django_extensions` package is invaluable.[1]

I have a shell open almost all the time, and use it constantly for testing functions, writing queries etc. It drives me crazy watching other Devs change a query, wait for the server to reload and refresh the browser repeatedly, when editing in the REPL is so much faster.

Being able to `dir` and tab complete experimentally is so fast. (I also have this in the ipdb debugger... Also Django extensions has a debugger inside templates which is really nice)

Being able to `%edit 1-20` and have the repl session instantly in my editor to copy paste is fantastic too.

I also use a lot of TDD for tasks that fit that style, mostly where I'm writing business logic or data processing functions... but for exploring data / APIs /queries / data shaping, interactive just feels instantly productive. Once I've got the API or whatever it is to correctly produce the happy path, it's then easy to copy that into the codebase knowing what shape to expect, I can then turn that into unit tests and throw all the weird external data and edge cases at it with reasonable confidence about what should be happening underneath.

It also has a mode to print out all SQL statements it runs underneath your code - which is great for checking that you've not missed a join or something and got n+1 sneaking in

[1] https://django-extensions.readthedocs.io/en/latest/

]]>
Wed, 27 Mar 2024 07:40:26 +0000https://news.ycombinator.com/item?id=39836490deckiedanhttps://news.ycombinator.com/item?id=39836490https://news.ycombinator.com/item?id=39836490
<![CDATA[New comment by aitchnyu in "How (and why) to run SQLite in production"]]>Is there a similar effort for Django? Django Sqlite driver is slow and not tested for production.

]]>
Wed, 27 Mar 2024 05:30:26 +0000https://news.ycombinator.com/item?id=39835953aitchnyuhttps://news.ycombinator.com/item?id=39835953https://news.ycombinator.com/item?id=39835953
<![CDATA[New comment by mannders in "Show HN: DeploySolo – The SaaS boilerplate for engineers. (Pocketbase/ Htmx)"]]>This is in addition to the educational content I'm going to be creating around this topic. While building DeploySolo, I spent 50% of my time reading source code and 50% in GitHub discussions.

Its a skill that engineers should develop to be comfortable with these resources.

But having tutorials and cookbooks that help achieve a user's specific goal is extremely helpful for the new engineer or the time conscious one.

I attribute a lot of Django/Laravel's popularity to these resources, that are currently missing in the Go/Pocketbase ecosystem.

]]>
Tue, 26 Mar 2024 14:27:42 +0000https://news.ycombinator.com/item?id=39828289manndershttps://news.ycombinator.com/item?id=39828289https://news.ycombinator.com/item?id=39828289
<![CDATA[New comment by physicsguy in "Show HN: Auto-generate an OpenAPI spec by listening to localhost"]]>I prefer going the other direction in practice, autogenerating the spec from the code e.g. with drf-spectacular for Django.

]]>
Tue, 26 Mar 2024 08:18:32 +0000https://news.ycombinator.com/item?id=39825309physicsguyhttps://news.ycombinator.com/item?id=39825309https://news.ycombinator.com/item?id=39825309
<![CDATA[New comment by __jonas in "Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs"]]>Well I suppose that's subjective, I probably put my bias in there but I would say:

For mostly static or content driven sites, there are really nice static site generators now. I find Astro[1] really pleasant to use, offering the convenience of SPA framework tooling, while allowing me to build sites that run without the need for any client-side JavaScript but the option to into client-side JS as needed.

But also NextJS has a similar static export function, and of course there are many other great SSGs outside the JavaScript world like Hugo.

For dynamic web applications like the example from my comment I would just do server side rendering using your language and framework of choice, Phoenix, Rails, Next, Django, whatever.

In both cases the issue with 404 routes is avoided.

[1] https://astro.build/

]]>
Mon, 25 Mar 2024 19:41:12 +0000https://news.ycombinator.com/item?id=39820480__jonashttps://news.ycombinator.com/item?id=39820480https://news.ycombinator.com/item?id=39820480
<![CDATA[New comment by airstrike in "Pyenv – lets you easily switch between multiple versions of Python"]]>I've been using python on and off since Django 0.96, which was released in 2007.

I don't recall ever needing anything other than virtualenvwrapper and pip—and even some of the annoyances these tools had early on have been solved by now...

https://virtualenvwrapper.readthedocs.io/en/latest/

If you really need different versions of python, you can just `mkvirtualenv -p python3 venvname`

I feel like every other tool out there has to explain what problem they solve that virtualenvwrapper doesn't

Don't install anything globally, creates lots of envs, and feel free to have different versions of python installed side-by-side with some "main" version preferably symlinked as `python` and `python3`

The end

]]>
Mon, 25 Mar 2024 16:11:59 +0000https://news.ycombinator.com/item?id=39818103airstrikehttps://news.ycombinator.com/item?id=39818103https://news.ycombinator.com/item?id=39818103
<![CDATA[New comment by sjducb in "Ask HN: Tips to get started on my own server"]]>Make and host a simple web app:

Django(Python) - gunicorn - nginx

You could run it on a raspberry pi for no ongoing cost

]]>
Mon, 25 Mar 2024 14:41:43 +0000https://news.ycombinator.com/item?id=39816931sjducbhttps://news.ycombinator.com/item?id=39816931https://news.ycombinator.com/item?id=39816931
<![CDATA[New comment by kerkeslager in "Pyenv – lets you easily switch between multiple versions of Python"]]>This is the sort of tool that experienced devs all use, but nobody teaches or writes it into a tutorial on the larger language as a whole, because it feels like a side tool.

For now I'm not seeing a lot of reasons to use PyEnv over the `venv` module that ships with Python 3.3+ [1]. I'm sure there are some thing PyEnv does that `venv` doesn't, but the fact that `venv` ships with Python greatly simplifies things.

Basically my workflow is:

1. I'll create a Python project with, `mkdir dirname`, `cd dirname`, `git init`, `python3 -m venv .env`. This creates a hidden folder named `.env/` which contains the virtual environment. I'll then usually add `.env/` to my `.gitignore`, and also run `pip install --upgrade pip` and `pip install wheel`.

2. If I'm using an existing project, I'll do `git clone `projname`, `cd dirname`, `python3 -m venv .env`, `pip install -m requirements.txt` (requirements.txt is the idiomatic name for the dependencies list in Python projects).

3. I have the following lines in my `~/.bashrc` (hidden file that contains Bash settings):

    # Gets a directory named .env or .venv if it exists in the currend directory or any of its parents
    get_env() {
      if [ -d "$1/.env" ] ; then
        echo "$1/.env"
      else
        if [ -d "$1/.venv" ] ; then
          echo "$1/.venv"
        else
          if [ -d "$1/.." ] ; then
            get_env "$1/.."
          fi
        fi
      fi
    }

    get_absolute_path() {
      python3 -c "import os; print(os.path.realpath('$1'))"
    }

    on_prompt() {
      # Load a virtualenv environment if it exists in a file named .env
      env_folder=$(get_env $(pwd))

      if [ -d "$env_folder" ] ; then
        if [[ $VIRTUAL_ENV != $(get_absolute_path $env_folder) ]] ; then
          echo "Activating env '$env_folder'"
          source "$env_folder/bin/activate"
        fi
      else
        if [ -d "$VIRTUAL_ENV" ] ; then
          deactivate
        fi
      fi
    }

    # Call on_prompt() every time the command prompt executes
    PROMPT_COMMAND=on_prompt
What this does is when I `cd` or `pushd` into a directory or subdirectory of a directory that contains a `.env/` folder, it loads the virtual environment, and when I leave said directories, it exits the virtual environment.

4. When I install a dependency, I use `pip freeze` to get the dependency string, and I append that line to the file `requirements.txt`. For example, if I do `pip install django`, I get `Django==5.0.1` in my output from `pip freeze`, so I'll append that line to my `requirements.txt`.

5. To upgrade dependencies, I edit the version number in the `requirements.txt` file, and then run `pip install -m requirements.txt`. This makes sure that the requirements file stays up-to-date with my locally installed dependencies.

6. To get valid version numbers for a file, you can do `pip install ==`, which is basically asking pip to install an invalid version number. This causes it to list valid version numbers. For example, you can do `pip install django==` to view all available Django versions.

[1] https://docs.python.org/3/library/venv.html

]]>
Mon, 25 Mar 2024 13:54:35 +0000https://news.ycombinator.com/item?id=39816328kerkeslagerhttps://news.ycombinator.com/item?id=39816328https://news.ycombinator.com/item?id=39816328
<![CDATA[New comment by nickjj in "Pyenv – lets you easily switch between multiple versions of Python"]]>Yeah, containers don't fully solve this problem.

We still need a generated lock file with every top level dependency and sub-dependencies locked down to their most precise version commit to version control so that when you build your image today or in 6 months you end up with the same result.

Using pip to freeze your dependencies and writing a tiny shell script to generate a lock file at build time is better than nothing to solve this problem with nothing more than pip. It's what I do in https://github.com/nickjj/docker-flask-example and https://github.com/nickjj/docker-django-example. It's not perfect but it solves 80% with minimal complexity.

]]>
Mon, 25 Mar 2024 12:51:37 +0000https://news.ycombinator.com/item?id=39815679nickjjhttps://news.ycombinator.com/item?id=39815679https://news.ycombinator.com/item?id=39815679
<![CDATA[New comment by throwaway38375 in "Web apps or Mobile apps for solopreneur?"]]>If you're going to be a team of one keep things simple.

If you know Python, use Django for full stack and FastAPI for APIs.

Although Go is great, I wouldn't add another language into the mix. Just not worth the overhead given that you can do so much with Python.

Also, try using boring old server side rendering as much as is possible.

Not to rag on Svelte specifically, but you'd be surprised at how far you can take a web app before needing to adopt a frontend framework!

]]>
Mon, 25 Mar 2024 11:26:23 +0000https://news.ycombinator.com/item?id=39814894throwaway38375https://news.ycombinator.com/item?id=39814894https://news.ycombinator.com/item?id=39814894
<![CDATA[New comment by LtWorf in "Majority of web apps could just run on a single server"]]>> This is in contrast to the experience of a Python developer who's mastered FastAPI/Flask/SQLAlchemy and feels absolutely lost in a Django project

If he has more than 6 months of experience he will figure it out.

]]>
Sun, 24 Mar 2024 21:47:39 +0000https://news.ycombinator.com/item?id=39810809LtWorfhttps://news.ycombinator.com/item?id=39810809https://news.ycombinator.com/item?id=39810809
<![CDATA[New comment by ProblemExplorer in "Majority of web apps could just run on a single server"]]>> unnecessarily complicated with k8s

Kubernetes is/was a way to fight off walled gardens from cloud providers. The other path would have been to learn the bespoke implementation of each cloud provider depending on what that employer ended up using.

Kubernetes was at the right place, at the right time just as AWS was trying to force feed people their own proprietary solution, as Azure was trying to wall off people into their own walled garden, as GCP was being Google just not giving a damn about any other usecase than what works great at a massive search company.

With Kubernetes, developers can learn one API to deploy their applications and hopefully it works on AWS, Azure, GCP, DO, OVH or a laptop at home.

So that way, developers can learn one thing and transfer their knowledge at an employer that hosts on AWS, and then another that hosts on Azure and so on.

This is in contrast to the experience of a Python developer who's mastered FastAPI/Flask/SQLAlchemy and feels absolutely lost in a Django project or an Angular developer who stares a Next.js project wondering what the heck is happening and how it all works. Neither a Next.js or an Angular developer would start off with an AWS Amplify solution if they could help it.

]]>
Sun, 24 Mar 2024 20:39:21 +0000https://news.ycombinator.com/item?id=39810294ProblemExplorerhttps://news.ycombinator.com/item?id=39810294https://news.ycombinator.com/item?id=39810294