django-getpaid / django-plans

Django application for managing account plans and quotas
MIT License
509 stars 127 forks source link

Demo project not work #178

Open vuducmanh11 opened 1 year ago

vuducmanh11 commented 1 year ago

I follow the instruction at https://django-plans.readthedocs.io/en/latest/installation.html and it doesn't work.

$ git clone https://github.com/django-getpaid/django-plans.git
$ cd django-plans/demo/
$ pip install -r requirements.txt
$ cd ..
$ python manage.py syncdb
> python: can't open file 'manage.py': [Errno 2] No such file or directory
$ python demo/manage.py syncdb
> ModuleNotFoundError: No module named 'plans'
$ cd demo
$ python manage.py syncdb
> ModuleNotFoundError: No module named 'plans'

How can i start demo project?

jkaeske commented 1 year ago

Same problem here

jkaeske commented 1 year ago

python demo/manage.py syncdb is now python demo/manage.py migrate That was the initial problem. But even after making it work, the given test1/test1 user/password combination does not seem to work for the login.

PetrDlouhy commented 1 year ago

@vuducmanh11 I have corrected the information at least at https://github.com/django-getpaid/django-plans/blob/master/docs/source/installation.rst

@jkaeske Please send a link to where in the documentation is mentioned that user/password for me to be able to fix the documentation problem. I have found, that the user is part of a initial_data.json fixture. So to load it in to database you should run:

 python manage.py loaddata example/foo/fixtures/initial_data.json
jkaeske commented 1 year ago

Shouldn't the command to clone be: git clone https://github.com/django-getpaid/django-plans.git

instead of: git clone git://github.com/cypreess/django-plans.git

since the repo is in django-getpaid now?

When trying to execute python manage.py loaddata example/foo/fixtures/initial_data.json the following error occurs, which is weird since the database is completely empty it that point: Could not load plans.Plan(pk=5): duplicate key value violates unique constraint "plans_plan_default_38b10231_uniq" DETAIL: Key ("default")=(f) already exists.

I got it to work by just creating a new superuser, but the test1/test1 (specified in the sign-in view -> picture below) does not seem to work for me.

image

jkaeske commented 1 year ago

Any news on this? I think the initial error still occurs for the demo project when trying to migrate or start the server ModuleNotFoundError: No module named 'plans'

vhsantos commented 10 months ago

Any news on this? I think the initial error still occurs for the demo project when trying to migrate or start the server ModuleNotFoundError: No module named 'plans'

Hi

you need to install the django-plans

pip install django-plans
vhsantos commented 10 months ago

When trying to execute python manage.py loaddata example/foo/fixtures/initial_data.json the following error occurs, which is weird since the database is completely empty it that point: Could not load plans.Plan(pk=5): duplicate key value violates unique constraint "plans_plan_default_38b10231_uniq" DETAIL: Key ("default")=(f) already exists.

There is a error with the initial_data.json because it try to setup differents plans with the "default" fields as "false" and default field is a unique field, so, this generate a error.

edit the example/foo/fixtures/initial_data.json and remove the 4 lines where related to default on plan.plan

--- a/demo/example/foo/fixtures/initial_data.json
+++ b/demo/example/foo/fixtures/initial_data.json
@@ -74,7 +74,6 @@
       "visible": true,
       "description": "Most recommended",
       "created": "2012-05-05T15:36:31Z",
-      "default": false,
       "customized": null,
       "order": 1,
       "name": "Premium"
@@ -88,7 +87,6 @@
       "visible": true,
       "description": "Professional plan",
       "created": "2012-07-12T13:07:23Z",
-      "default": false,
       "customized": null,
       "order": 2,
       "name": "PRO"
@@ -102,7 +100,6 @@
       "visible": true,
       "description": "Custom for test1",
       "created": "2012-07-12T17:33:30.112Z",
-      "default": false,
       "customized": 1,
       "order": 4,
       "name": "Custom"
@@ -116,7 +113,6 @@
       "visible": true,
       "description": "Custom test 2",
       "created": "2012-07-24T12:51:57.438Z",
-      "default": false,
       "customized": 2,
       "order": 5,
       "name": "Custom 2"