Giter VIP home page Giter VIP logo

reactivated's People

Contributors

crgwbr avatar dependabot[bot] avatar devo-wm avatar kyczawon avatar lukezsmith avatar minism avatar morenoh149 avatar silviogutierrez 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  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

reactivated's Issues

Pick doesn't serialise ids correctly for nested model properties

I found an issue with serialisation where parent id overrides children ids during serialisation.

Example

Assume I have the following 2 models and a property in the parent which extract data from the child:

class ChildInfo(TypedDict):
    id: str
    description: str

class ParentModel(models.Model):
   @property
    def children_info(self) -> List[ChildInfo]:
        children = ChildModel.objects.filter(parent__pk=self.id)
        return [ChildInfo(id=child.id, description=child.description) for child in children]

class ChildModel(models.Model):
    parent = models.ForeignKey(
        to=Parent,
        verbose_name="linked [parent",
    )

    description = models.TextField()

Template:

@template
class View(NamedTuple):
    parent: Pick[models. ParentModel, "id", "children_info"]

Now assume I have ParentModel (id:1) linked to two ChildModels (id:20 & id: 25)

When I print children_info on django side I get the ids as expected:

[{'id': 20, 'description': 'test'}, {'id': 25, 'description': 'test2'}]

However, on client side the parent id overrides the children ids:

{
'id': 1,
'children_info': [{'id': 1, 'description': 'test'}, {'id': 1, 'description': 'test2'}]
}

Temporary Fix

Changing the definition of ChildInfo fixed the issue:

class ChildInfo(TypedDict):
    version_id: str
    description: str

And I correctly get the same output on both django and client side:

[{'version_id': 20, 'description': 'test'}, {'version_id': 25, 'description': 'test2'}]

Question

Is there an issue with serialisation when a name clash between ids happens?

Consider not using nix

This project is very cool and exciting and fits a real need. I love how it combines React with idiomatic Django.

With that said, I know the philosophy page says it's very opinionated, which it should be. However, I don't think it should be opinionated about dependency tooling. This project should reconsider the nix requirement.

This is the second time I've seriously considered using this library, but the nix requirement is a huge turn off. I remember the first time I learned about, my evaluation was, "Oh man, nix. That would be a significant change to our stack on top of adopting this reactivated thing." I would already be taking a big step by adopting reactivated. In addition to adopting a new opinionated library, I don't think requiring people to adopt a new tool like nix is a good idea for adoption. That's two major changes to my tooling.

Think about it from a business perspective. We don't just go in blind adopting whatever technology we want. We have a mature dependency tool chain, and adopting reactivated WITH nix is a significant change to that tool chain. You have teammates to consider — people with opinions and who are proficient/experts at your existing tool chain. It's similar to when you're working on a python project and you have your pyenv dialed in, then you want to use a new python library but it only works with anaconda.

nix seems really cool and perhaps it's something my team should adopt, but requiring me to adopt it when I'm adopting another new technology adds friction to adopting the actual tool that you created. In my opinion, this will hinder the future of this project.

The project is already blazing a trail with the React/Django combo. It doesn't need to trailblaze with nix. Ideally, it would be tooling agnostic and developers would have the flexibility to use nix or whatever tooling they want. Are you trying to sell us on nix or reactivated? If you're trying to sell us on nix, then sell it with this project but don't require us to use it.

That's my two cents. Thanks for creating a cool, much needed project in the Django ecosystem.

nix setup script fails on MacOS

This nix setup script seems to not create certain required files. I'm on MacOS.

nix-shell -E "$(curl -L https://reactivated.io/install/)"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   434  100   434    0     0    835      0 --:--:-- --:--:-- --:--:--   835
Enter a project name
again
ln: failed to create symbolic link 'again/server/settings/__init__.py': No such file or directory
tree again
again
├── client
│   ├── components
│   │   └── Layout.tsx
│   ├── forms.tsx
│   ├── index.tsx
│   ├── styles.css.ts
│   └── templates
│       ├── PollComments.tsx
│       ├── PollDetail.tsx
│       ├── PollsIndex.tsx
│       └── Results.tsx
├── gitignore.template
├── requirements.txt
└── scripts
    ├── deploy.sh
    ├── fix.sh
    ├── helpers.sh
    ├── launch.sh
    ├── remove_example.sh
    └── test.sh

4 directories, 16 files
cd again
nix-shell
error: path '/Users/stephanfitzpatrick/projects/removeme/again/default.nix' does not exist

Using reactivated to power dynamic forms

Hey! I’m excited to use reactivated, but I’m not sure that I understand if theres a way to render dynamic forms. Could someone point me to an example of a dynamic form using the

tag? (By dynamic form, I mean a form which has a number of fields that can be changed by the user.)

Nix-shell install seems incomplete (error about no package.json)

Background:

I have Nix installed on Mac. I ran the instructions listed here: https://www.reactivated.io/documentation/getting-started/

The nix-shell -E $(curl ...) command possibly did not finish properly, as I was left in the nix-shell until exiting a few times (see log below).

Once exiting the nix-shell created by that command, attempting to run nix-shell in the new directory complains that no package.json file exists.

This log is from the second time I tried it, after removing the directory created the first time. (That is why there aren't a bunch of nix download commands in here, I think).

projects/futz/reactivated-test 
➜  nix-shell -E "$(curl -L https://reactivated.io/install/)"

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   434  100   434    0     0    288      0  0:00:01  0:00:01 --:--:--     0
Enter a project name
rv-demo
Initialized empty Git repository in /Volumes/projects/futz/reactivated-test/rv-demo/.git/
bash-5.2$ ls
Dockerfile  client  manage.py  mypy.ini  pytest.ini  requirements.nix  requirements.txt  scripts  server  shell.nix  static  tsconfig.json
bash-5.2$ ls server/                                                                                                                                                                                       
__init__.py  asgi.py  example  settings  urls.py  wsgi.py
bash-5.2$ find . -name 'package.json'                                                                                                                                                                      
bash-5.2$ exit                                                                                                                                                                                             
bash-5.2$ exit
bash-5.2$ exit
bash-5.2$ exit
bash-5.2$ exit
[main (root-commit) 2e4a2c7] Initial files
 55 files changed, 2056 insertions(+)
 create mode 100644 .babelrc.json
 create mode 100644 .dockerignore
 create mode 100644 .editorconfig
 create mode 100644 .eslintrc.json
 create mode 100644 .flake8
 create mode 100644 .gitignore
 create mode 100644 .isort.cfg
 create mode 100644 .prettierrc
 create mode 100644 .shellcheckrc
 create mode 100644 Dockerfile
 create mode 100644 client/components/Layout.tsx
 create mode 100644 client/forms.tsx
 create mode 100644 client/index.tsx
 create mode 100644 client/styles.tsx
 create mode 100644 client/templates/DjangoDefault.tsx
 create mode 100644 client/templates/EditPoll.tsx
 create mode 100644 client/templates/FormPlayground.tsx
 create mode 100644 client/templates/PollComments.tsx
 create mode 100644 client/templates/PollDetail.tsx
 create mode 100644 client/templates/PollsIndex.tsx
 create mode 100644 client/templates/Results.tsx
 create mode 100755 manage.py
 create mode 100644 mypy.ini
 create mode 100644 pytest.ini
 create mode 100644 requirements.nix
 create mode 100644 requirements.txt
 create mode 100755 scripts/deploy.sh
 create mode 100755 scripts/fix.sh
 create mode 100644 scripts/helpers.sh
 create mode 100755 scripts/launch.sh
 create mode 100755 scripts/remove_example.sh
 create mode 100755 scripts/test.sh
 create mode 100644 server/__init__.py
 create mode 100644 server/asgi.py
 create mode 100644 server/example/__init__.py
 create mode 100644 server/example/admin.py
 create mode 100644 server/example/apps.py
 create mode 100644 server/example/context_processors.py
 create mode 100644 server/example/forms.py
 create mode 100644 server/example/migrations/0001_initial.py
 create mode 100644 server/example/migrations/__init__.py
 create mode 100644 server/example/models.py
 create mode 100644 server/example/templates.py
 create mode 100644 server/example/tests.py
 create mode 100644 server/example/urls.py
 create mode 100644 server/example/views.py
 create mode 120000 server/settings/__init__.py
 create mode 100644 server/settings/common.py
 create mode 100644 server/settings/localhost.py
 create mode 100644 server/settings/production.py
 create mode 100644 server/urls.py
 create mode 100644 server/wsgi.py
 create mode 100644 shell.nix
 create mode 100644 static/favicon.ico
 create mode 100644 tsconfig.json


All done. You can start your project by running

cd rv-demo
nix-shell
python manage.py runserver

projects/futz/reactivated-test took 1m5s 
➜  cd rv-demo 

rv-demo on  main via  v3.10.6 
➜  nix-shell
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Volumes/projects/futz/reactivated-test/rv-demo/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Volumes/projects/futz/reactivated-test/rv-demo/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/nelsonjs/.npm/_logs/2023-04-30T19_17_30_168Z-debug-0.log
bash: /Volumes/projects/futz/reactivated-test/rv-demo/node_modules/.bin/setup_environment.sh: No such file or directory

[nix-shell:/Volumes/projects/futz/reactivated-test/rv-demo]$ python manage.py runserver
Traceback (most recent call last):
  File "/Volumes/projects/futz/reactivated-test/rv-demo/manage.py", line 11, in main
    from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Volumes/projects/futz/reactivated-test/rv-demo/manage.py", line 22, in <module>
    main()
  File "/Volumes/projects/futz/reactivated-test/rv-demo/manage.py", line 13, in main
    raise ImportError(
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?

[nix-shell:/Volumes/projects/futz/reactivated-test/rv-demo]$ 

Basic Setup Failing

Not sure if the project is still live and being worked on (it looks very promising!) but trying to build via the official instructions had a host of errors for me.

Specifically, these look like potential sources of issues:

bash: lesspipe: command not found

Cannot find package 'ts-morph'

ESLint couldn't find the plugin "eslint-plugin-react".
Cannot find package '@vanilla-extract/esbuild-plugin'

This is not the tsc command you are looking for
To get access to the TypeScript compiler, tsc, from the command line either:
- Use npm install typescript to first add TypeScript to your project before using npx
- Use yarn to avoid accidentally running code from un-installed packages

Then, when trying to open localhost:8000, there was no connection ('Unable to connect')

Let me know if you need any additional info; I'd love to get this working if possible!

Full Terminal Output

max@max-desktop:$ cd Documents/
max@max-desktop:
/Documents$ ls
GitHub 'HW Manager' LocalCode
max@max-desktop:/Documents$ cd GitHub/
max@max-desktop:
/Documents/GitHub$ nix-shell -E "$(curl -L https://reactivated.io/install/)"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 434 100 434 0 0 268 0 0:00:01 0:00:01 --:--:-- 0
Enter a project name
DemoReactivated
Initialized empty Git repository in /home/max/Documents/GitHub/DemoReactivated/.git/
bash: lesspipe: command not found
Wrote to /home/max/Documents/GitHub/DemoReactivated/package.json:

{
"name": "demoreactivated",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}

bash: lesspipe: command not found

added 1 package, and audited 2 packages in 732ms

found 0 vulnerabilities
bash: lesspipe: command not found
created virtual environment CPython3.9.13.final.0-64 in 284ms
creator CPython3Posix(dest=/home/max/Documents/GitHub/DemoReactivated/.venv, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/max/.local/share/virtualenv)
added seed packages: pip==22.0.4, setuptools==61.0.0, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
Collecting Django==4.0.1
Using cached Django-4.0.1-py3-none-any.whl (8.0 MB)
Collecting psycopg2-binary==2.9.3
Using cached psycopg2_binary-2.9.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB)
Collecting simplejson==3.16.0
Using cached simplejson-3.16.0-cp39-cp39-linux_x86_64.whl
Collecting django-stubs==1.9.0
Using cached django_stubs-1.9.0-py3-none-any.whl (401 kB)
Collecting mypy==0.910
Using cached mypy-0.910-cp39-cp39-manylinux2010_x86_64.whl (23.2 MB)
Collecting black==22.3.0
Using cached black-22.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB)
Collecting isort==5.10.1
Using cached isort-5.10.1-py3-none-any.whl (103 kB)
Collecting pytest==6.2.5
Using cached pytest-6.2.5-py3-none-any.whl (280 kB)
Collecting pytest-django==4.5.2
Using cached pytest_django-4.5.2-py3-none-any.whl (20 kB)
Collecting flake8==4.0.1
Using cached flake8-4.0.1-py2.py3-none-any.whl (64 kB)
Collecting autoflake==1.4
Using cached autoflake-1.4-py3-none-any.whl
Collecting gunicorn==20.1.0
Using cached gunicorn-20.1.0-py3-none-any.whl (79 kB)
Collecting dj-database-url==0.5.0
Using cached dj_database_url-0.5.0-py2.py3-none-any.whl (5.5 kB)
Collecting reactivated==0.33.1
Using cached reactivated-0.33.1-py3-none-any.whl (81 kB)
Collecting asgiref<4,>=3.4.1
Using cached asgiref-3.7.2-py3-none-any.whl (24 kB)
Collecting sqlparse>=0.2.2
Using cached sqlparse-0.4.4-py3-none-any.whl (41 kB)
Collecting types-pytz
Using cached types_pytz-2023.3.1.1-py3-none-any.whl (4.9 kB)
Collecting typing-extensions
Using cached typing_extensions-4.9.0-py3-none-any.whl (32 kB)
Collecting types-PyYAML
Using cached types_PyYAML-6.0.12.12-py3-none-any.whl (14 kB)
Collecting toml
Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting django-stubs-ext>=0.3.0
Using cached django_stubs_ext-4.2.7-py3-none-any.whl (8.9 kB)
Collecting mypy-extensions<0.5.0,>=0.4.3
Using cached mypy_extensions-0.4.4-py2.py3-none-any.whl
Collecting click>=8.0.0
Using cached click-8.1.7-py3-none-any.whl (97 kB)
Requirement already satisfied: platformdirs>=2 in /nix/store/0njw1jhx2azm9v0a9rjkmgzfrmp89m7c-python3.9-platformdirs-2.5.2/lib/python3.9/site-packages (from black==22.3.0->-r requirements.txt (line 6)) (2.5.2)
Collecting tomli>=1.1.0
Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
Collecting pathspec>=0.9.0
Using cached pathspec-0.12.1-py3-none-any.whl (31 kB)
Collecting attrs>=19.2.0
Using cached attrs-23.1.0-py3-none-any.whl (61 kB)
Collecting py>=1.8.2
Using cached py-1.11.0-py2.py3-none-any.whl (98 kB)
Collecting pluggy<2.0,>=0.12
Using cached pluggy-1.3.0-py3-none-any.whl (18 kB)
Collecting iniconfig
Using cached iniconfig-2.0.0-py3-none-any.whl (5.9 kB)
Collecting packaging
Using cached packaging-23.2-py3-none-any.whl (53 kB)
Collecting pycodestyle<2.9.0,>=2.8.0
Using cached pycodestyle-2.8.0-py2.py3-none-any.whl (42 kB)
Collecting mccabe<0.7.0,>=0.6.0
Using cached mccabe-0.6.1-py2.py3-none-any.whl (8.6 kB)
Collecting pyflakes<2.5.0,>=2.4.0
Using cached pyflakes-2.4.0-py2.py3-none-any.whl (69 kB)
Requirement already satisfied: setuptools>=3.0 in ./.venv/lib/python3.9/site-packages (from gunicorn==20.1.0->-r requirements.txt (line 13)) (61.0.0)
Collecting requests-unixsocket==0.3.0
Using cached requests_unixsocket-0.3.0-py2.py3-none-any.whl (11 kB)
Collecting requests==2.25.0
Using cached requests-2.25.0-py2.py3-none-any.whl (61 kB)
Collecting certifi>=2017.4.17
Using cached certifi-2023.11.17-py3-none-any.whl (162 kB)
Collecting idna<3,>=2.5
Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
Collecting chardet<4,>=3.0.2
Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting urllib3<1.27,>=1.21.1
Using cached urllib3-1.26.18-py2.py3-none-any.whl (143 kB)
Installing collected packages: types-PyYAML, types-pytz, mccabe, dj-database-url, chardet, urllib3, typing-extensions, tomli, toml, sqlparse, simplejson, pyflakes, pycodestyle, py, psycopg2-binary, pluggy, pathspec, packaging, mypy-extensions, isort, iniconfig, idna, gunicorn, click, certifi, attrs, requests, pytest, mypy, flake8, black, autoflake, asgiref, requests-unixsocket, pytest-django, Django, reactivated, django-stubs-ext, django-stubs
Successfully installed Django-4.0.1 asgiref-3.7.2 attrs-23.1.0 autoflake-1.4 black-22.3.0 certifi-2023.11.17 chardet-3.0.4 click-8.1.7 dj-database-url-0.5.0 django-stubs-1.9.0 django-stubs-ext-4.2.7 flake8-4.0.1 gunicorn-20.1.0 idna-2.10 iniconfig-2.0.0 isort-5.10.1 mccabe-0.6.1 mypy-0.910 mypy-extensions-0.4.4 packaging-23.2 pathspec-0.12.1 pluggy-1.3.0 psycopg2-binary-2.9.3 py-1.11.0 pycodestyle-2.8.0 pyflakes-2.4.0 pytest-6.2.5 pytest-django-4.5.2 reactivated-0.33.1 requests-2.25.0 requests-unixsocket-0.3.0 simplejson-3.16.0 sqlparse-0.4.4 toml-0.10.2 tomli-2.0.1 types-PyYAML-6.0.12.12 types-pytz-2023.3.1.1 typing-extensions-4.9.0 urllib3-1.26.18

[notice] A new release of pip available: 22.1.2 -> 23.3.1
[notice] To update, run: pip install --upgrade pip
The files belonging to this database system will be owned by user "max".
This user must also own the server process.

The database cluster will be initialized with locale "C".
The default database encoding has accordingly been set to "SQL_ASCII".
The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory /home/max/Documents/GitHub/DemoReactivated/.venv/postgresql ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

/nix/store/axji8ka65rx9pp5l5ga4k8bng730xg30-postgresql-13.7/bin/pg_ctl -D /home/max/Documents/GitHub/DemoReactivated/.venv/postgresql -l logfile start

[12/Dec/2023 23:32:29,778] Generating interfaces and client side code
node:internal/errors:465
ErrorCaptureStackTrace(err);
^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'ts-morph' imported from /home/max/Documents/GitHub/DemoReactivated/node_modules/reactivated/dist/generator.mjs
at new NodeError (node:internal/errors:372:5)
at packageResolve (node:internal/modules/esm/resolve:954:9)
at moduleResolve (node:internal/modules/esm/resolve:1003:20)
at defaultResolve (node:internal/modules/esm/resolve:1218:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
at ModuleWrap. (node:internal/modules/esm/module_job:80:40)
at link (node:internal/modules/esm/module_job:78:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
node:internal/errors:465
ErrorCaptureStackTrace(err);
^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'ts-morph' imported from /home/max/Documents/GitHub/DemoReactivated/node_modules/reactivated/dist/generator/constants.mjs
at new NodeError (node:internal/errors:372:5)
at packageResolve (node:internal/modules/esm/resolve:954:9)
at moduleResolve (node:internal/modules/esm/resolve:1003:20)
at defaultResolve (node:internal/modules/esm/resolve:1218:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
at ModuleWrap. (node:internal/modules/esm/module_job:80:40)
at link (node:internal/modules/esm/module_job:78:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
[12/Dec/2023 23:32:30,413] Finished generating.
bash: lesspipe: command not found
Operations to perform:
Apply all migrations: admin, auth, contenttypes, example, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying auth.0012_alter_user_first_name_max_length... OK
Applying example.0001_initial... OK
Applying sessions.0001_initial... OK
bash: lesspipe: command not found
Running against all git files
[Python]:
manage.py
server/init.py
server/asgi.py
server/example/init.py
server/example/admin.py
server/example/apps.py
server/example/context_processors.py
server/example/forms.py
server/example/migrations/0001_initial.py
server/example/migrations/init.py
server/example/models.py
server/example/templates.py
server/example/tests.py
server/example/urls.py
server/example/views.py
server/settings/init.py
server/settings/common.py
server/settings/localhost.py
server/settings/production.py
server/urls.py
server/wsgi.py

client/components/Layout.tsx
client/forms.tsx
client/index.tsx
client/styles.tsx
client/templates/DjangoDefault.tsx
client/templates/EditPoll.tsx
client/templates/FormPlayground.tsx
client/templates/PollComments.tsx
client/templates/PollDetail.tsx
client/templates/PollsIndex.tsx
client/templates/Results.tsx
package-lock.json
package.json
tsconfig.json

client/forms.tsx
client/index.tsx
client/styles.tsx
client/templates/DjangoDefault.tsx
client/templates/EditPoll.tsx
client/templates/FormPlayground.tsx
client/templates/PollComments.tsx
client/templates/PollDetail.tsx
client/templates/PollsIndex.tsx
client/templates/Results.tsx

scripts/fix.sh
scripts/helpers.sh
scripts/launch.sh
scripts/remove_example.sh
scripts/test.sh

shell.nix

[Terraform]:

All done! ✨ 🍰 ✨
21 files left unchanged.

Oops! Something went wrong! :(

ESLint: 8.55.0

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "/home/max/Documents/GitHub/DemoReactivated".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in ".eslintrc.json » ./node_modules/reactivated/dist/eslintrc.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

.eslintrc.json 50ms (unchanged)
client/components/Layout.tsx 253ms (unchanged)
client/forms.tsx 24ms (unchanged)
client/index.tsx 6ms (unchanged)
client/styles.tsx 15ms (unchanged)
client/templates/DjangoDefault.tsx 30ms
client/templates/EditPoll.tsx 22ms (unchanged)
client/templates/FormPlayground.tsx 9ms (unchanged)
client/templates/PollComments.tsx 24ms (unchanged)
client/templates/PollDetail.tsx 18ms (unchanged)
client/templates/PollsIndex.tsx 11ms (unchanged)
client/templates/Results.tsx 6ms (unchanged)
package-lock.json 5ms
package.json 1ms
tsconfig.json 2ms (unchanged)
[main (root-commit) 1dc0930] Initial files
56 files changed, 2141 insertions(+)
create mode 100644 .dockerignore
create mode 100644 .editorconfig
create mode 100644 .eslintrc.json
create mode 100644 .flake8
create mode 100644 .gitignore
create mode 100644 .isort.cfg
create mode 100644 .prettierrc
create mode 100644 .shellcheckrc
create mode 100644 Dockerfile
create mode 100644 client/components/Layout.tsx
create mode 100644 client/forms.tsx
create mode 100644 client/index.tsx
create mode 100644 client/styles.tsx
create mode 100644 client/templates/DjangoDefault.tsx
create mode 100644 client/templates/EditPoll.tsx
create mode 100644 client/templates/FormPlayground.tsx
create mode 100644 client/templates/PollComments.tsx
create mode 100644 client/templates/PollDetail.tsx
create mode 100644 client/templates/PollsIndex.tsx
create mode 100644 client/templates/Results.tsx
create mode 100755 manage.py
create mode 100644 mypy.ini
create mode 100644 package-lock.json
create mode 100644 package.json
create mode 100644 pytest.ini
create mode 100644 requirements.nix
create mode 100644 requirements.txt
create mode 100755 scripts/deploy.sh
create mode 100755 scripts/fix.sh
create mode 100644 scripts/helpers.sh
create mode 100755 scripts/launch.sh
create mode 100755 scripts/remove_example.sh
create mode 100755 scripts/test.sh
create mode 100644 server/init.py
create mode 100644 server/asgi.py
create mode 100644 server/example/init.py
create mode 100644 server/example/admin.py
create mode 100644 server/example/apps.py
create mode 100644 server/example/context_processors.py
create mode 100644 server/example/forms.py
create mode 100644 server/example/migrations/0001_initial.py
create mode 100644 server/example/migrations/init.py
create mode 100644 server/example/models.py
create mode 100644 server/example/templates.py
create mode 100644 server/example/tests.py
create mode 100644 server/example/urls.py
create mode 100644 server/example/views.py
create mode 120000 server/settings/init.py
create mode 100644 server/settings/common.py
create mode 100644 server/settings/localhost.py
create mode 100644 server/settings/production.py
create mode 100644 server/urls.py
create mode 100644 server/wsgi.py
create mode 100644 shell.nix
create mode 100644 static/favicon.ico
create mode 100644 tsconfig.json

All done. You can start your project by running

cd DemoReactivated
nix-shell
python manage.py runserver
max@max-desktop:/Documents/GitHub$ psql
Password for user max:
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: password authentication failed for user "max"
max@max-desktop:
/Documents/GitHub$ cd DemoReactivated/
max@max-desktop:~/Documents/GitHub/DemoReactivated$ nix-shell

[nix-shell:~/Documents/GitHub/DemoReactivated]$ python manage.py runserver
[12/Dec/2023 23:34:22,066] Generating interfaces and client side code
[12/Dec/2023 23:34:22,067] Skipping generation as nothing has changed
node:internal/errors:465
ErrorCaptureStackTrace(err);
^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@vanilla-extract/esbuild-plugin' imported from /home/max/Documents/GitHub/DemoReactivated/node_modules/reactivated/dist/build.client.mjs
at new NodeError (node:internal/errors:372:5)
at packageResolve (node:internal/modules/esm/resolve:954:9)
at moduleResolve (node:internal/modules/esm/resolve:1003:20)
at defaultResolve (node:internal/modules/esm/resolve:1218:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
at ModuleWrap. (node:internal/modules/esm/module_job:80:40)
at link (node:internal/modules/esm/module_job:78:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
node:internal/errors:465
ErrorCaptureStackTrace(err);
^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@vanilla-extract/esbuild-plugin' imported from /home/max/Documents/GitHub/DemoReactivated/node_modules/reactivated/dist/build.renderer.mjs
at new NodeError (node:internal/errors:372:5)
at packageResolve (node:internal/modules/esm/resolve:954:9)
at moduleResolve (node:internal/modules/esm/resolve:1003:20)
at defaultResolve (node:internal/modules/esm/resolve:1218:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
at ModuleWrap. (node:internal/modules/esm/module_job:80:40)
at link (node:internal/modules/esm/module_job:78:36) {
code: 'ERR_MODULE_NOT_FOUND'
}

            This is not the tsc command you are looking for                

To get access to the TypeScript compiler, tsc, from the command line either:

  • Use npm install typescript to first add TypeScript to your project before using npx
  • Use yarn to avoid accidentally running code from un-installed packages

^CTraceback (most recent call last):
File "/home/max/Documents/GitHub/DemoReactivated/manage.py", line 22, in
main()
File "/home/max/Documents/GitHub/DemoReactivated/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/home/max/Documents/GitHub/DemoReactivated/.venv/lib/python3.9/site-packages/django/core/management/init.py", line 425, in execute_from_command_line
utility.execute()
File "/home/max/Documents/GitHub/DemoReactivated/.venv/lib/python3.9/site-packages/django/core/management/init.py", line 381, in execute
autoreload.check_errors(django.setup)()
File "/home/max/Documents/GitHub/DemoReactivated/.venv/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/home/max/Documents/GitHub/DemoReactivated/.venv/lib/python3.9/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/max/Documents/GitHub/DemoReactivated/.venv/lib/python3.9/site-packages/django/apps/registry.py", line 122, in populate
app_config.ready()
File "/home/max/Documents/GitHub/DemoReactivated/.venv/lib/python3.9/site-packages/reactivated/apps.py", line 179, in ready
processes.start_renderer()
File "/home/max/Documents/GitHub/DemoReactivated/.venv/lib/python3.9/site-packages/reactivated/processes.py", line 55, in start_renderer
if match := re.match(r"RENDERER:([/.\w]+):LISTENING", output):
File "/nix/store/r8hi2lpzycparplcq0y663c43866f9bz-python3-3.9.13/lib/python3.9/re.py", line 191, in match
return _compile(pattern, flags).match(string)
File "/nix/store/r8hi2lpzycparplcq0y663c43866f9bz-python3-3.9.13/lib/python3.9/re.py", line 289, in _compile
def _compile(pattern, flags):
KeyboardInterrupt

[nix-shell:~/Documents/GitHub/DemoReactivated]$

How to use PostCSS plugins with Reactivated

Hi, I'm trying to get PostCSS to work in my Mantine + Reactivated project.

I saw that the docs recommended vanilla extract but I would like to use traditional css modules like in the mantine docs

I've taken all the steps I usually take to get postcss + mantine setup, but my @mixins aren't working

Here's my postcss.config.cjs file

module.exports = {
    plugins: {
      'postcss-mixins': {},
      'postcss-preset-mantine': {},
      'postcss-simple-vars': {
        variables: {
          'mantine-breakpoint-xs': '36em',
          'mantine-breakpoint-sm': '48em',
          'mantine-breakpoint-md': '62em',
          'mantine-breakpoint-lg': '75em',
          'mantine-breakpoint-xl': '88em',
        },
      },
    },
  };

chrome_mgRBfOwjGy

As you can see my theme toggle is broken, the icon should be hidden when in the respective mode

CSS for theme toggle:

.icon {
    width: rem(22px);
    height: rem(22px);
  }
  
  .dark {
    @mixin dark {
      display: none;
    }
  
    @mixin light {
      display: block;
    }
  }
  
  .light {
    @mixin light {
      display: none;
    }
  
    @mixin dark {
      display: block;
    }
}

I've installed and setup PostCSS so what's going on? Is this a Reactivated problem? Or am I missing something?

Issues integrating in existing Django App

I was having issues integrating the project in my existing template so I decided to create a new django project from scratch to rule out as much as possible.

I created the following repo: https://github.com/knowsuchagency/hello_reactivated/

When running python manage.py runserver I'm getting

client/templates/Default.tsx:3:25 - error TS2306: File '/Users/stephanfitzpatrick/projects/hello_reactivated/node_modules/_reactivated/index.tsx' is not a module.

3 import {templates} from "@reactivated";

The content of node_modules/_reactivated/index.tsx is simply.

// Digest: b4231b936ca007529ec0cc1fc4926ea27e286c37

It seems something isn't being compiled?

alongside a screen recording of the issue I'm having:

Screen.Recording.2024-03-26.at.5.45.58.PM.mov

Migrations not applying/can't exec into container

Hi, I am trying to use Reactivated with django-tenants

I'm unable to connect to my postgres database when using a custom database engine.

My database connection is setup to use a custom engine (django-tenants) like this:

db_from_env = dj_database_url.config(default="postgres:///database")
db_from_env['ENGINE'] = "django_tenants.postgresql_backend"

DATABASES = {
    "default": db_from_env
}

Looking at the docs it looks like nix-shell handles setting up my database environments variables and I'm just supposed to exec into my container with docker exec -it my_app nix-shell and run my migrate command from there.

But trying to exec using nix-shell gives me OCI runtime exec failed: exec failed: unable to start container process: exec: "nix-shell": executable file not found in $PATH: unknown

If I remove the db_from_env['ENGINE'] = "django_tenants.postgresql_backend" my Docker deployment works and connects to the database, but adding an engine gives a 500 error.

NVIDIA_Share_etL5bNlx9v

Any ideas? Have a feeling I'm doing something wrong with nix-shell/Docker.

Typing error > python3.9

Hey I have an existing project that I'd like to use reactivated with but when I install it and run the server it shows a number of typing errors.

File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "venv/lib/python3.11/site-packages/reactivated/__init__.py", line 35, in <module>
    from .backend import JSX as JSX  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv/lib/python3.11/site-packages/reactivated/backend.py", line 11, in <module>
    from .serialization import create_schema, serialize
  File "venv/lib/python3.11/site-packages/reactivated/serialization/__init__.py", line 396, in <module>
    class FormSetType(NamedTuple):
  File "venv/lib/python3.11/site-packages/reactivated/serialization/__init__.py", line 497, in FormSetType
    Type[django_forms.BaseFormSet[Any]], django_forms.BaseFormSet[Any]
         ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
TypeError: type 'BaseFormSet' is not subscriptable

The project is running in 3.9 but I also tried on 3.11 and it shows the same, anything to look out on my side?

Installation using nix fails with fatal error on WSL

I have nix setup under WSL2 Debian.

I am at the nix-shell -E "$(curl -L https://reactivated.io/install/)" step.
Python dependencies seem to be installed OK. Then yarn starts adding js packages. It errors out saying

├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
Done in 14.85s.
fatal: not a git repository (or any of the parent directories): .git

If I go to the newly created project directory and run the app, there are warnings about migrations but I get the homepage at port 8000. Clicking on the polls app errors out:

relation "example_question" does not exist

This seems to be because the setup is not complete yet.

Update automated test suite to use a test matrix

We can do this to support older Python versions (I'm not suggesting we support 2.7 😆) Perhaps as old as 3.6.x, maybe 3.5.x. Also Django 2.x?

Potential Tooling:

Examples in the wild:
dateutil uses tox: https://github.com/dateutil/dateutil/blob/master/tox.ini
Django uses tox: https://github.com/django/django/blob/master/tox.ini

Issue finding npm path

I decided to give this a shot when integrating into an existing project and came across path referencing issues, specifically for npm based commands that are run via the subprocess.Popen commands (apologies if I've got the terminology wrong here). I've got the path to my npm set up correctly, can run the npm exec generate_client_configuration globally from the terminal and can see the path when printing out the PATH env variable before the command. Specifiying the full path to npm in those commands works and I wasn't sure where to next in terms of fault finding.

A potential solution I've seen is in the django-tailwind app, where the path to npm can be set within the settings file to overcome this issue. A quick look through the source shows reactivated\app.py and reactivated\__init__.py containing references to npm, I'd be happy to create a PR but I'm still quite new to the git side of house so bear with me on that front haha

Best strategy for implementing contrib.auth context processor by default?

Hi there,

Firstly thanks for your great work on this package, this is giving us the best of both worlds for prototyping, I love how productive it feels!

I couldn't find in the documentation a recommendation for this, so I'm curious what your thoughts are. I'd like to get the contrib.auth context processor working by default in reactivated.

I was able to do this by overriding reactivated/serialization/context_processors.py and injecting:

from django.contrib.auth.models import User
from reactivated import Pick

...

class AuthProcessor(NamedTuple):
    user: Pick[User, "username", ...]

TYPE_HINTS = {
    ...
    "django.contrib.auth.context_processors.auth": {
      "return": AuthProcessor
    },
}

Which seems to work, however I'm not sure if its appropriate to import contrib.auth.models here.

I suppose the question is, is there a better way to approach this, or would the recommendation be simply to forego the contrib.auth context processor entirely and re-implement it yourself (with proper typing)?

Error installing reactivated - initdb: error: invalid locale settings; check LANG and LC_* environment variables

OS: Fedora 32
Multi-user installation of NixOS

Commands

nix-shell -E "$(curl -L https://reactivated.io/install/)"

Output

bash: register-python-argcomplete: command not found...
Install package 'python3-argcomplete' to provide command 'register-python-argcomplete'? [N/y] y

Failed to install packages: python3-argcomplete-1.10.0-4.fc32.noarch is already installed
bash: Dockerfile: command not found...
Install package 'procps-ng' to provide command 'pidof'? [N/y] y

Install package 'which' to provide command 'which'? [N/y] y

yarn install v1.22.17
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Saved lockfile.
Done in 0.15s.
created virtual environment CPython3.9.9.final.0-64 in 2656ms
  creator CPython3Posix(dest=/home/.../projects_nix/test_reango/.venv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/.../.local/share/virtualenv)
    added seed packages: pip==21.3.1, setuptools==58.3.0, wheel==0.37.0
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
The files belonging to this database system will be owned by user "...".
This user must also own the server process.

initdb: error: invalid locale settings; check LANG and LC_* environment variables

Client generation fails with unnamed URLs

Discussed in #342

Originally posted by jhemelae March 5, 2024
Hi,

Thanks for your work on Reactivated. I'm now trying it out for the first time and I'm running into the issue that as soon as I run python manage.py runserver for my first basic project, the file node_modules/_reactivated/index.tsx is edited automatically, the content is removed and replaced by just one single comment: // Digest: and then a hash.

As a result, the statement import {templates} from "@reactivated"; and similar now result in an error: 'node_modules/_reactivated/index.tsx' is not a module.

Any idea about the cause of the issue or possible workarounds? I followed the instructions on reactivated.io using the Nix shell.

Error installing reactivated on WSL2/Windows with Nix: invalid database permissions

Following instructions to install reactivated on WSL2 leads to an error with data directory permissions:

running bootstrap script ... 2023-05-26 15:08:24.140 UTC [141544] FATAL:  data directory "/mnt/c/Users/cheaton/projects/react/test/.venv/postgresql" has invalid permissions

The more complete error:

creating directory /mnt/c/Users/cheaton/projects/react/test/.venv/postgresql ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 20
selecting default shared_buffers ... 400kB
selecting default time zone ... UTC
creating configuration files ... ok
running bootstrap script ... 2023-05-26 15:11:01.476 UTC [146151] FATAL:  data directory "/mnt/c/Users/cheaton/projects/react/test/.venv/postgresql" has invalid permissions
2023-05-26 15:11:01.476 UTC [146151] DETAIL:  Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).
child process exited with exit code 1
initdb: removing data directory "/mnt/c/Users/cheaton/projects/react/test/.venv/postgresql"
Traceback (most recent call last):
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/db/backends/base/base.py", line 230, in ensure_connection
    self.connect()
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/utils/asyncio.py", line 25, in inner
    return func(*args, **kwargs)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/db/backends/base/base.py", line 211, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/utils/asyncio.py", line 25, in inner
    return func(*args, **kwargs)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/db/backends/postgresql/base.py", line 199, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: connection to server on socket "/run/user/1000//reactivated/c2f17a4afaa1040356f83ab82317ebb7/.s.PGSQL.1" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/mnt/c/Users/cheaton/projects/react/test/manage.py", line 22, in <module>
    main()
  File "/mnt/c/Users/cheaton/projects/react/test/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line
    utility.execute()
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/core/management/base.py", line 373, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/core/management/base.py", line 417, in execute
    output = self.handle(*args, **options)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/core/management/base.py", line 90, in wrapped
    res = handle_func(*args, **kwargs)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 75, in handle
    self.check(databases=[database])
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/core/management/base.py", line 438, in check
    all_issues = checks.run_checks(
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/core/checks/registry.py", line 77, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/core/checks/model_checks.py", line 34, in check_all_models
    errors.extend(model.check(**kwargs))
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/db/models/base.py", line 1307, in check
    *cls._check_indexes(databases),
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/db/models/base.py", line 1699, in _check_indexes
    connection.features.supports_covering_indexes or
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/db/backends/postgresql/features.py", line 84, in is_postgresql_11
    return self.connection.pg_version >= 110000
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/db/backends/postgresql/base.py", line 339, in pg_version
    with self.temporary_connection():
  File "/nix/store/r8hi2lpzycparplcq0y663c43866f9bz-python3-3.9.13/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/db/backends/base/base.py", line 614, in temporary_connection
    with self.cursor() as cursor:
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/utils/asyncio.py", line 25, in inner
    return func(*args, **kwargs)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/db/backends/base/base.py", line 270, in cursor
    return self._cursor()
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/db/backends/base/base.py", line 246, in _cursor
    self.ensure_connection()
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/utils/asyncio.py", line 25, in inner
    return func(*args, **kwargs)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/db/backends/base/base.py", line 230, in ensure_connection
    self.connect()
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/db/backends/base/base.py", line 230, in ensure_connection
    self.connect()
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/utils/asyncio.py", line 25, in inner
    return func(*args, **kwargs)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/db/backends/base/base.py", line 211, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/utils/asyncio.py", line 25, in inner
    return func(*args, **kwargs)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/django/db/backends/postgresql/base.py", line 199, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/mnt/c/Users/cheaton/projects/react/test/.venv/lib/python3.9/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: connection to server on socket "/run/user/1000//reactivated/c2f17a4afaa1040356f83ab82317ebb7/.s.PGSQL.1" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?

version 0.38.0 broke our dev environmen

hey @silviogutierrez

I recent start a new project using v0.37.0 (I'm not using nix BTW). on Monday morning w had Unexpected surprise when for whatever npm decided to upgrade the package version to 0.38.0. unfortunately, this broken all of our existing work. I have pin the version back to 0.37.0. my concerns are

  1. the change form default to Template it will break all our pages since we have the old format, changing it would be a big regression
  2. would we have to update to 0.38.0 to get the newer update, I saw the process killing issue was fixed, will i be able to get it without this update
  3. I saw you comment somewhere saying this just works but wasn't prod ready, so what the plan moving forward

Add additional documentation to the `docs/` folder

Impossible to gain adopters without user documentation of the public API in some capacity.

Things to think about:

  1. Stale docs should be considered a high level issue/bug.
  2. How can we keep the docs up-to-date and know if the docs need to be updated? Is there any way to automate warnings to ourselves?

How to access postgres from host

How can I access Postgres dev database with something like postico? It might be related to nNxOs but I just can't figure it out 🤔

scripts/launch.sh Errors

Hi,

Firstly, thanks for creating the framework!

I am running into two issues when trying to use the scripts/launch.sh helper script to launch a reactivated app.
These seem to be flyctl issues.

Issue 1: flyctl info

Line 28:

APP_NAME=$(flyctl info --json | jq .App.Name -r)

Should be:

APP_NAME=$(flyctl status --json | jq .Name -r)

Issue 2: flyctl postgres attach

Line 37:

for _ in 1 2 3 4 5 6 7 8 9 10; do flyctl postgres attach --postgres-app "$CLUSTER_NAME" && break || sleep 30; done

Should be:

for _ in 1 2 3 4 5 6 7 8 9 10; do flyctl postgres attach "$CLUSTER_NAME" && break || sleep 30; done

I am running macOS Ventura 13.4 and flyctl v0.1.34.

Website broken

All examples on the docs website are just [object Object],[object Object],[object Object]
Screenshot 2024-02-18 at 21 26 14

manage.py build fails after adding Reactivated to existing project

Hi, thanks for this project! I'm new to Django, but the connection between Reactivated templates and React is really intuitive. I've been following the documentation to add Reactivated to an existing project and had some trouble when trying to build the assets manually.

manage.py runserver works to build all of the frontend code on startup, but I was trying to manually run the following build steps for a production deployment with Daphne.

  • manage.py generate_client_assets (worked as expected)
  • manage.py build (didn't work, fails at the tsc --noemit step)

I narrowed the problem down to needing a tsconfig.json in the BASE_DIR, which is present when creating a fresh Reactivated project with the automated scripts. If this is the correct approach, I'm happy to submit a PR for a documentation update to note that users of existing projects need to also add a tsconfig.json.

What do you think about automated approaches such as an initialization script in the npm package that will add the default files necessary? The PyPI package could also have its own script to generate Django specific files. I'm imagining it could lead the user through prompts to make sure there are no existing conflicts.

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.