I changed the permissions,but nothing changed 😢. Envoyé de mon iPhone
> Le 3 mai 2020 à 15:25, Jorge Gimeno <jlgimen...@gmail.com> a écrit : > >  > > >> On Sun, May 3, 2020 at 3:46 AM Amina Anna Mahamane.O <aaminn...@gmail.com> >> wrote: >> I read , but I didn’t help me , I don’t really know hiw to process . Can you >> explain me ? > > I'm not a linux expert, so other folks can feel free to correct me. > > In linux, the user that creates the file in a directory they have access to > has "ownership" of the file. With that, the user can both read and write to > the file. All other users (except for sudo users, I believe) have read-only > access by default. > > That's what's happening here. When you ran migrations as the currently > logged in user, your user has read and write permissions. Apache, however, > runs as a different user, so it cannot write to the database. > > That answer I linked did have some things to try, in addition to a link to > more general question about permissions. The file you would need to change > permissioins on (since you're using sqlite3, which is file based) is named > (without quotes) "db.sqlite3'. > > Hope this helps! > > -Jorge >> >> Envoyé de mon iPhone >> >>>> Le 3 mai 2020 à 05:21, Jorge Gimeno <jlgimen...@gmail.com> a écrit : >>>> >>>  >>> >>> >>>> On Sat, May 2, 2020 at 8:09 PM Amina Anna Mahamane.O <aaminn...@gmail.com> >>>> wrote: >>>> Hello , I started learning how to use django . I made a project without a >>>> virtual environnement and without apach2 andn mod wsgi . >>>> Now am I trying to do a project with those ones . I am a beginner .When I >>>> try to log in to the administration interface, the error below >>>> appears.I've been looking for solutions on the internet for hours and >>>> hours but I didn't find anything which can help me to solve my problem. I >>>> have no idea what could have caused this error.I really need help, it's >>>> urgent. I wish someone can answer to me in french but if it is not >>>> possible, help me anyway, I will manage. >>>> >>>> OperationalError at /admin/login/ >>>> >>>> attempt to write a readonly database >>>> Request Method: POST >>>> Request URL: >>>> http://www.djangoproject.localhost/admin/login/?next=/admin/ >>>> Django Version: 3.0.5 >>>> Exception Type: OperationalError >>>> Exception Value: >>>> attempt to write a readonly database >>>> Exception Location: >>>> /home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py >>>> in execute, line 396 >>>> Python Executable: /home/kirikou/mysite/env/bin/python >>>> Python Version: 3.7.5 >>>> Python Path: >>>> ['/home/kirikou/mysite', >>>> '/usr/lib/python37.zip', >>>> '/usr/lib/python3.7', >>>> '/usr/lib/python3.7/lib-dynload', >>>> '/home/kirikou/mysite/env/lib/python3.7/site-packages'] >>>> Server time: Sat, 2 May 2020 21:39:20 +0000 >>>> >>>> >>>> >>>> Environment: >>>> >>>> >>>> Request Method: POST >>>> Request URL: http://www.djangoproject.localhost/admin/login/?next=/admin/ >>>> >>>> Django Version: 3.0.5 >>>> Python Version: 3.7.5 >>>> Installed Applications: >>>> ['applis.apps.ApplisConfig', >>>> 'django.contrib.admin', >>>> 'django.contrib.auth', >>>> 'django.contrib.contenttypes', >>>> 'django.contrib.sessions', >>>> 'django.contrib.messages', >>>> 'django.contrib.staticfiles', >>>> 'django.contrib.admindocs'] >>>> Installed Middleware: >>>> ['django.middleware.security.SecurityMiddleware', >>>> 'django.contrib.sessions.middleware.SessionMiddleware', >>>> 'django.middleware.common.CommonMiddleware', >>>> 'django.middleware.csrf.CsrfViewMiddleware', >>>> 'django.contrib.auth.middleware.AuthenticationMiddleware', >>>> 'django.contrib.messages.middleware.MessageMiddleware', >>>> 'django.middleware.clickjacking.XFrameOptionsMiddleware'] >>>> >>>> >>>> >>>> Traceback (most recent call last): >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/utils.py", >>>> line 86, in _execute >>>> return self.cursor.execute(sql, params) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", >>>> line 396, in execute >>>> return Database.Cursor.execute(self, query, params) >>>> >>>> The above exception (attempt to write a readonly database) was the direct >>>> cause of the following exception: >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/exception.py", >>>> line 34, in inner >>>> response = get_response(request) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/base.py", >>>> line 115, in _get_response >>>> response = self.process_exception_by_middleware(e, request) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/core/handlers/base.py", >>>> line 113, in _get_response >>>> response = wrapped_callback(request, *callback_args, **callback_kwargs) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/views/decorators/cache.py", >>>> line 44, in _wrapped_view_func >>>> response = view_func(request, *args, **kwargs) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/contrib/admin/sites.py", >>>> line 407, in login >>>> return LoginView.as_view(**defaults)(request) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/views/generic/base.py", >>>> line 71, in view >>>> return self.dispatch(request, *args, **kwargs) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/utils/decorators.py", >>>> line 43, in _wrapper >>>> return bound_method(*args, **kwargs) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/views/decorators/debug.py", >>>> line 76, in sensitive_post_parameters_wrapper >>>> return view(request, *args, **kwargs) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/utils/decorators.py", >>>> line 43, in _wrapper >>>> return bound_method(*args, **kwargs) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/utils/decorators.py", >>>> line 130, in _wrapped_view >>>> response = view_func(request, *args, **kwargs) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/utils/decorators.py", >>>> line 43, in _wrapper >>>> return bound_method(*args, **kwargs) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/views/decorators/cache.py", >>>> line 44, in _wrapped_view_func >>>> response = view_func(request, *args, **kwargs) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/contrib/auth/views.py", >>>> line 63, in dispatch >>>> return super().dispatch(request, *args, **kwargs) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/views/generic/base.py", >>>> line 97, in dispatch >>>> return handler(request, *args, **kwargs) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/views/generic/edit.py", >>>> line 142, in post >>>> return self.form_valid(form) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/contrib/auth/views.py", >>>> line 92, in form_valid >>>> auth_login(self.request, form.get_user()) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/contrib/auth/__init__.py", >>>> line 107, in login >>>> request.session.cycle_key() >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/contrib/sessions/backends/base.py", >>>> line 310, in cycle_key >>>> self.create() >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/contrib/sessions/backends/db.py", >>>> line 55, in create >>>> self.save(must_create=True) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/contrib/sessions/backends/db.py", >>>> line 87, in save >>>> obj.save(force_insert=must_create, force_update=not must_create, >>>> using=using) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/models/base.py", >>>> line 746, in save >>>> force_update=force_update, update_fields=update_fields) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/models/base.py", >>>> line 784, in save_base >>>> force_update, using, update_fields, >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/models/base.py", >>>> line 887, in _save_table >>>> results = self._do_insert(cls._base_manager, using, fields, >>>> returning_fields, raw) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/models/base.py", >>>> line 926, in _do_insert >>>> using=using, raw=raw, >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/models/manager.py", >>>> line 82, in manager_method >>>> return getattr(self.get_queryset(), name)(*args, **kwargs) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/models/query.py", >>>> line 1204, in _insert >>>> return query.get_compiler(using=using).execute_sql(returning_fields) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/models/sql/compiler.py", >>>> line 1391, in execute_sql >>>> cursor.execute(sql, params) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/utils.py", >>>> line 100, in execute >>>> return super().execute(sql, params) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/utils.py", >>>> line 68, in execute >>>> return self._execute_with_wrappers(sql, params, many=False, >>>> executor=self._execute) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/utils.py", >>>> line 77, in _execute_with_wrappers >>>> return executor(sql, params, many, context) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/utils.py", >>>> line 86, in _execute >>>> return self.cursor.execute(sql, params) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/utils.py", >>>> line 90, in __exit__ >>>> raise dj_exc_value.with_traceback(traceback) from exc_value >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/utils.py", >>>> line 86, in _execute >>>> return self.cursor.execute(sql, params) >>>> File >>>> "/home/kirikou/mysite/env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", >>>> line 396, in execute >>>> return Database.Cursor.execute(self, query, params) >>>> >>>> Exception Type: OperationalError at /admin/login/ >>>> Exception Value: attempt to write a readonly database >>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google Groups >>>> "Django users" group. >>>> To unsubscribe from this group and stop receiving emails from it, send an >>>> email to django-users+unsubscr...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/django-users/e3757628-10c9-4251-ac79-1e892f4348c7%40googlegroups.com. >>> >>> I don't use Apache much, but I found this on a Google search. Running >>> migrations from the terminal uses the current logged in user (unless one >>> uses sudo, which I wouldn't recommend). Unlike other servers, it seems >>> that Apache runs not with the currently logged in user, but it's own user. >>> So the database can be read, but can't be written to because of >>> permissions. See if this helps: >>> https://stackoverflow.com/questions/17641993/operationalerror-attempt-to-write-a-readonly-database-in-ubuntu-server >>> >>> -Jorge >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to django-users+unsubscr...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/CANfN%3DK_XW%2BM9c530nv%3D%3D76GG%3DD1D0z8VaiL_8aMFNtBLk5X8jw%40mail.gmail.com. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/B5CF2B50-6AF4-4713-8F67-640B8AE68CD5%40gmail.com. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CANfN%3DK_xrj19Cgq-723aZtQ3cniU2D4eqLd%2BE-2t7D21KmVKuQ%40mail.gmail.com. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7810F917-3C72-494D-808E-D6DDB4D5E020%40gmail.com.