mbi / django-simple-captcha

Django Simple Captcha is an extremely simple, yet highly customizable Django application to add captcha images to any Django form.
http://django-simple-captcha.readthedocs.io/en/latest/
MIT License
1.38k stars 319 forks source link

PermissionError: [Errno 13] Permission denied: '.../0002_alter_captchastore_id.py' #200

Closed maksam07 closed 3 years ago

maksam07 commented 3 years ago

Why?

Operations to perform:
  Apply all migrations: account, admin, auth, captcha, contenttypes, sessions
Running migrations:
  No migrations to apply.
  Your models in app(s): 'captcha' have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
***:$ python manage.py makemigrations

Migrations for 'captcha':
  /usr/local/lib/python3.9/site-packages/captcha/migrations/0002_alter_captchastore_id.py
    - Alter field id on captchastore
Traceback (most recent call last):
  File "/usr/src/app/manage.py", line 22, in <module>
    main()
  File "/usr/src/app/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 89, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/makemigrations.py", line 190, in handle
    self.write_migration_files(changes)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/makemigrations.py", line 228, in write_migration_files
    with open(writer.path, "w", encoding='utf-8') as fh:
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.9/site-packages/captcha/migrations/0002_alter_captchastore_id.py'

django-simple-captcha==0.5.14

mbi commented 3 years ago

Well, you're not supposed to create migrations for installed 3rd party apps.

The real question though, is why your project thinks that Django Simple Captcha changed and needs a migration. Which version of Django is this?

maksam07 commented 3 years ago

latest 3.2 I am ready to give any other additional information. I myself do not understand why this is happening. It doesn't seem to be the first time you run the project

mbi commented 3 years ago

Could you please report back what is returned by

python manage.py makemigrations  --dry-run    
maksam07 commented 3 years ago
Migrations for 'captcha':
  /usr/local/lib/python3.9/site-packages/captcha/migrations/0002_alter_captchastore_id.py
    - Alter field id on captchastore
mbi commented 3 years ago

Okay I see, this is likely related to the new AutoField feature introduced with Django 3.2

You can probably safely ignore that warning.

mbi commented 3 years ago

Closing.