I've been struggling to deploy my django project with Apache and mod_wsgi. I've had many problems that I managed to handle, but this one just seems not to be solvable.
I get the following error in my apache log when I enter the address setakshop.ir:8080 :
[Wed May 27 05:54:24 2015] [error] Internal Server Error: /en-gb/
[Wed May 27 05:54:24 2015] [error] Traceback (most recent call last):
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 87, in get_response
[Wed May 27 05:54:24 2015] [error] response = middleware_method(request)
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/oscar/apps/basket/middleware.py", line 26, in process_request
[Wed May 27 05:54:24 2015] [error] strategy = selector.strategy(request=request, user=request.user)
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/oscar/apps/partner/strategy.py", line 39, in strategy
[Wed May 27 05:54:24 2015] [error] return Default(request)
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/oscar/apps/partner/strategy.py", line 57, in __init__
[Wed May 27 05:54:24 2015] [error] if request and request.user.is_authenticated():
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 224, in inner
[Wed May 27 05:54:24 2015] [error] self._setup()
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 357, in _setup
[Wed May 27 05:54:24 2015] [error] self._wrapped = self._setupfunc()
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/middleware.py", line 22, in <lambda>
[Wed May 27 05:54:24 2015] [error] request.user = SimpleLazyObject(lambda: get_user(request))
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/middleware.py", line 10, in get_user
[Wed May 27 05:54:24 2015] [error] request._cached_user = auth.get_user(request)
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/__init__.py", line 152, in get_user
[Wed May 27 05:54:24 2015] [error] user_id = request.session[SESSION_KEY]
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/contrib/sessions/backends/base.py", line 49, in __getitem__
[Wed May 27 05:54:24 2015] [error] return self._session[key]
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/contrib/sessions/backends/base.py", line 175, in _get_session
[Wed May 27 05:54:24 2015] [error] self._session_cache = self.load()
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/contrib/sessions/backends/db.py", line 29, in load
[Wed May 27 05:54:24 2015] [error] self.create()
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/contrib/sessions/backends/db.py", line 41, in create
[Wed May 27 05:54:24 2015] [error] self.save(must_create=True)
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/contrib/sessions/backends/db.py", line 64, in save
[Wed May 27 05:54:24 2015] [error] obj.save(force_insert=must_create, using=using)
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 589, in save
[Wed May 27 05:54:24 2015] [error] force_update=force_update, update_fields=update_fields)
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 617, in save_base
[Wed May 27 05:54:24 2015] [error] updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 698, in _save_table
[Wed May 27 05:54:24 2015] [error] result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 731, in _do_insert
[Wed May 27 05:54:24 2015] [error] using=using, raw=raw)
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 92, in manager_method
[Wed May 27 05:54:24 2015] [error] return getattr(self.get_queryset(), name)(*args, **kwargs)
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 921, in _insert
[Wed May 27 05:54:24 2015] [error] return query.get_compiler(using=using).execute_sql(return_id)
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 921, in execute_sql
[Wed May 27 05:54:24 2015] [error] cursor.execute(sql, params)
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 65, in execute
[Wed May 27 05:54:24 2015] [error] return self.cursor.execute(sql, params)
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 94, in __exit__
[Wed May 27 05:54:24 2015] [error] six.reraise(dj_exc_type, dj_exc_value, traceback)
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 65, in execute
[Wed May 27 05:54:24 2015] [error] return self.cursor.execute(sql, params)
[Wed May 27 05:54:24 2015] [error] File "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py", line 485, in execute
[Wed May 27 05:54:24 2015] [error] return Database.Cursor.execute(self, query, params)
[Wed May 27 05:54:24 2015] [error] OperationalError: attempt to write a readonly database
Now I googled this error and searched a lot, I mean a lot! I know that the db.sqlite file must have write permissions and it should be owned by apache ( www-data ), also the directory containing it must have write permissions and be owned by www-data. and I have done these two things. I don't have selinux installed, I've ran ./manage.py migrate, and I don't know what else I can do to make this work, I even chmoded both the directory and the db.sqlite file to 777 to just see if it will work, but it didn't and I know that's not a safe thing to do.
now for your information this is the folder containing the db.sqlite file:
-rw-rw-r-- 1 ashkan ashkan 382 Jan 30 11:54 README.rst
-rw-rw-r-- 1 ashkan ashkan 0 Jan 30 11:54 __init__.py
drwxrwxr-x 4 ashkan ashkan 4096 Feb 6 15:15 apps
-rwxrwxrwx 1 www-data www-data 741376 May 27 09:11 db.sqlite
drwxrwxr-x 7 ashkan ashkan 4096 Jan 30 11:54 deploy
drwxrwxr-x 2 ashkan ashkan 4096 Jan 30 11:54 fixtures
drwxrwxr-x 2 ashkan ashkan 4096 Feb 22 00:14 i18n
drwxrwxr-x 3 ashkan ashkan 4096 Feb 23 21:45 locale
drwxr-xr-x 2 ashkan ashkan 4096 May 26 08:33 logs
-rwxrwxr-x 1 ashkan ashkan 242 May 26 00:22 manage.py
lrwxrwxrwx 1 ashkan ashkan 10 May 25 23:15 oscar -> i18n/oscar
drwxrwxr-x 4 ashkan ashkan 4096 Jan 30 21:53 public
-rw-rw-r-- 1 ashkan ashkan 14306 May 26 00:07 settings.py
-rw-r--r-- 1 ashkan ashkan 10230 May 26 00:23 settings.pyc
-rw-rw-r-- 1 ashkan ashkan 14876 Feb 6 14:26 settings.py~
-rw-rw-r-- 1 ashkan ashkan 293 Jan 30 11:54 settings_mysql.py
-rw-rw-r-- 1 ashkan ashkan 266 May 26 00:16 settings_postgres.py
-rw-rw-r-- 1 ashkan ashkan 162 Jan 30 11:54 settings_sphinx.py
drwxrwxr-x 2 ashkan ashkan 4096 Feb 23 21:45 static
drwxrwxr-x 3 ashkan ashkan 4096 Jan 30 11:54 templates
-rwxrwxr-x 1 ashkan ashkan 1114 Jan 30 11:54 test_migrations.sh
-rwxrwxr-x 1 ashkan ashkan 1138 Jan 30 11:54 update_latest.sh
-rw-rw-r-- 1 ashkan ashkan 1573 Jan 30 11:54 urls.py
-rw-rw-r-- 1 ashkan ashkan 1427 Jan 30 21:53 urls.pyc
drwxr-xr-x 2 ashkan ashkan 4096 Jan 30 20:58 whoosh_index
-rw-rw-r-- 1 ashkan ashkan 778 May 26 00:23 wsgi.py
and this is the directory containing the db.sqlite file:
-rw-rw-r-- 1 ashkan ashkan 866 Jan 30 11:54 README.rst
drwxrwxr-x 2 ashkan ashkan 4096 Jan 30 11:54 _fixtures
-rw-rw-r-- 1 ashkan ashkan 897149 Feb 6 15:34 alaki
-rw-rw-r-- 1 ashkan ashkan 1818857 Feb 6 15:37 alaki.txt
drwxrwxr-x 9 ashkan ashkan 4096 Jan 30 11:54 demo
-rw-rw-r-- 1 ashkan ashkan 443627 Feb 6 15:34 out
drwxrwxrwx 12 www-data www-data 4096 May 27 09:11 sandbox
drwxrwxr-x 5 ashkan ashkan 4096 Jan 30 11:54 us
any idea what's causing this problem? thank you.
Aucun commentaire:
Enregistrer un commentaire