Error creating admin user Django 1.11

2

I'm trying to create a user admin , but it always returns me the error below. What can be happening?

I'm using the following settings:

Ubuntu Server 14.04.5 LTS, 
Python 3.4.3, 
Django 1.11. 

Any help will be welcome.

Username (leave blank to use 'ubuntu'): ubuntu
Email address: [email protected]
Password:
Password (again):
  

Traceback (most recent call last): File   "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/db/backends/utils.py",   line 65, in execute       return self.cursor.execute (sql, params) File "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py",   line 328, in execute       return Database.Cursor.execute (self, query, params) sqlite3.OperationalError: attempt to write a readonly database       self.UserModel._default_manager.db_manager (database) .create_superuser (** user_data)   Filet   "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/contrib/auth/models.py",   line 170, in create_superuser       return self._create_user (username, email, password, ** extra_fields) File "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/contrib/auth/models.py",   line 153, in _create_user       user.save (using = self._db) File "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/contrib/auth/base_user.py",   line 80, in save       super (AbstractBaseUser, self) .save (* args, ** kwargs) File "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/db/models/base.py",   line 806, in save       force_update = force_update, update_fields = update_fields) File "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/db/models/base.py",   line 836, in save_base       updated = self.save_table (raw, cls, force_insert, force_update, using, update_fields) File   "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/db/models/base.py",   line 922, in _save_table       result = self._do_insert (cls_base_manager, using, fields, update_pk, raw) File   "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/db/models/base.py",   line 961, in _do_insert       using = using, raw = raw) File "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/db/models/manager.py",   line 85, in manager_method       return getattr (self.get_queryset (), name) (* args, ** kwargs) File "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/db/models/query.py" ,   line 1060, in _insert       return query.get_compiler (using = using) .execute_sql (return_id) File   "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/db/models/sql/compiler.py",   line 1099, in execute_sql       cursor.execute (sql, params) File "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/db/backends/utils.py",   line 80, in execute       return super (CursorDebugWrapper, self) .execute (sql, params) File "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/db/backends/utils.py",   line 65, in execute       return self.cursor.execute (sql, params) File "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/db/utils.py",   line 94, in exit       six.reraise (dj_exc_type, dj_exc_value, traceback) File "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/utils/six.py",   line 685, in reraise       raise value.with_traceback (tb) File "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/db/backends/utils.py",   line 65, in execute       return self.cursor.execute (sql, params) File "/var/www/html/meusitedjango/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py",   line 328, in execute       return Database.Cursor.execute (self, query, params) django.db.utils.OperationalError: attempt to write a readonly database   (myitedjango)   ubuntu @ ubuntuserver: / var / www / html / meuitedjango / myitedjango $

    
asked by anonymous 08.06.2017 / 16:08

1 answer

2

It seems to me, by the excerpt:

"/var/www/html/meusitedjango/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute return Database.Cursor.execute(self, query, params) sqlite3.OperationalError: attempt to write a readonly database 

That your database is being used in readyonly mode.

try changing directory owner and db to www-data

chown www-data:www-data /home/username/Django    
chown www-data:www-data /home/username/Django/db.sqlite  
    
08.06.2017 / 16:22