GithubHelp home page GithubHelp logo

lightmatter / django-hydra Goto Github PK

View Code? Open in Web Editor NEW
88.0 88.0 10.0 38.36 MB

A django/htmx/alpine/tailwind project template

Home Page: https://django-hydra.readthedocs.io/

Python 35.75% Shell 5.16% JavaScript 3.29% HTML 1.83% Dockerfile 0.98% SCSS 6.53% TypeScript 6.97% Jinja 39.50%

django-hydra's People

Contributors

alex3917 avatar alligatortower avatar ammarm08 avatar brianedelman avatar c-alcium avatar dennovin avatar dependabot[bot] avatar edcohen08 avatar gone avatar gregazevedo avatar greghausheer avatar jake-kent avatar jamesjohnson avatar joshgking avatar jschneier avatar knyghty avatar lightstrike avatar mattehues avatar mciocchi avatar mdutro002 avatar melissafelch avatar mhotwagner avatar omni5cience avatar pieropalevsky avatar ryhinchey avatar samamorgan avatar t-a-y-l-o-r avatar universe-man avatar wismer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-hydra's Issues

setup_database.sh on debian

Reporting something interesting that blocks the template execution when run on Debian Linux with a fresh Postgres installation.

This report is essentially the inverse of this StackOverflow.

I appears as though one of the (reasonable) assumptions made by the setup_database.sh script is that the user executing the template can, out of the box, create a role via psql.

On Debian, the pre-installed roles and databases are postgres.

postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of 
-----------+------------------------------------------------------------+-----------
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
postgres=# \l
                              List of databases
   Name    |  Owner   | Encoding | Collate |  Ctype  |   Access privileges   
-----------+----------+----------+---------+---------+-----------------------
 postgres  | postgres | UTF8     | C.UTF-8 | C.UTF-8 | 
 template0 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +
           |          |          |         |         | postgres=CTc/postgres
 template1 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +
           |          |          |         |         | postgres=CTc/postgres
(3 rows)

Not to belabor the report, but the current workaround is to su to user postgres, and add a role and database named after the user executing the template.

bibby=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of 
-----------+------------------------------------------------------------+-----------
 bibby     | Superuser, Create role, Create DB                          | {}
 django-tpl| Superuser, Create DB                                       | {}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
bibby=# \l
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 bibby      | postgres   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 django-tpl | django-tpl | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 postgres   | postgres   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0  | postgres   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(5 rows)

There are likely several ways to resolve this cleanly, but I imagine an interruption to request privilege escalation (sudo) would be necessary at some point.

Shell scripts need love

Most of our shell scripts don't fail hard enough, we should probably set -o errexit for most, if not all of them.

Improve Tests

Do a pass through the project and make sure everything is tested

setup_database.sh for docker db

psql (specifically /usr/bin/psql from a docker host) doesn't smoothly interact with a postgres container with the project database.

I'm creating this Issue to share a simple workaround: prepend setup_database.sh with a local override for psql that proxies to docker exec. When present, everything works as expected.

psql() {
    docker exec -it $DB_CONTAINER psql -U $DB_USER $DB_NAME "$@"
}

The above works with sidecar containers that are started in a similar fashion to those defined in this example docker-compose.yml

---

myproject-db:
  image: postgres
  container_name: myproject-db
  environment:
    POSTGRES_DB: $DB_NAME
    POSTGRES_PASSWORD: $DB_PASSWORD
    POSTGRES_USER: $DB_USER
    PGDATA: /var/lib/postgresql/data/pgdata
  volumes:
    - /opt/volumes/myproject/db:/var/lib/postgresql/data/pgdata
  ports:
    - 5432:5432

myproject-redis:
  image: redis
  container_name: myproject-redis
  ports:
    - 6379:6379

Dropdown menus in django admin using tom select get hidden

Fields that are defined as a ForeignKey get a dropdown in django admin and TomSelect is taking over currently. The dropdown box is getting cut off due to a couple of overflow hiddens.
I got around this by just using autocomplete_fields to leverage select2 which ships with django by default. IMO we should turn tom select off for django admin entirely.
Screen Shot 2022-12-07 at 3 18 50 PM

Caching form responses

It may be helpful to create an autosave primitive for forms.
This could potentially save to the DB or possibly even localstorage. This would be especially helpful if chaining forms (such as while using a formwizard), and allow a user to come back to a form with values already prefilled.

Things to think about:
If we do decide to use a DB for this, how would we generate a UUID to lookup responses? How would cleanup be implemented
Alternatively, if using localstorage (preferred IMO), do we want to invalidate the entry after a certain time?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.