Forums

manage.py: Permission denied

Alright, this is getting kinda annoying. I can't run my manage.py in /home/CyanPrime/Dropbox/pythonanywhere/mysite/manage.py

I was trying to syncdb at first, but then I tried help, and that was denied too. Can someone tell me whats going on? I can run manage.py in /home/CyanPrime/nouse/manage.py just fine, but I can't run the one in my Dropbox for some reason. :<

Hi there, that sounds like a permissions issue. How are you trying to run manage.py? Is it like this:

./manage.py syncdb

What happens if you try it like this instead?:

python manage.py syncdb

If that works, the problem was probably that you need to add "execute" permissions to manage.py. If you want to fix it, compare the output of

ls -la ~/nouse/manage.py 
ls -la ~/Dropbox/pythonanywhere/mysite/manage.py

And take a note of the differences. You probably need to make sure that both the owner and group execute permissions are set:

chmod og+x manage.py

Alternatively, just use python manage.py!

Uhh, sorry it took so long. I just tried the python command on it, and got this:

0:56 ~/Dropbox/pythonanywhere/mysite $ python manage.py syncdb                                                                                                                                     
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/core/management/__init__.py", line 429, in execute_from_command_line
utility.execute()
  File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/core/management/__init__.py", line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/core/management/commands/syncdb.py", line 7, in <module>
from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/core/management/sql.py", line 6, in <module>
from django.db import models
File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/db/__init__.py", line 14, in <module>
if not settings.DATABASES:
File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/utils/functional.py", line 276, in __getattr__
self._setup()
File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/conf/__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/conf/__init__.py", line 92, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'mysite.settings' (Is it on sys.path?): No module named mysite.settings
20:56 ~/Dropbox/pythonanywhere/mysite $

Okay, I changed the string "mysite.settings" to "settings" and got this error instead:

20:59 ~/Dropbox/pythonanywhere/mysite $ python manage.py syncdb
Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/core/management/init.py", line 429, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/core/management/init.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/core/management/init.py", line 252, in fetch_command app_name = get_commands()[subcommand] File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/core/management/init.py", line 101, in get_commands apps = settings.INSTALLED_APPS File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/utils/functional.py", line 276, in getattr self._setup() File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/conf/init.py", line 42, in _setup self._wrapped = Settings(settings_module) File "/usr/local/lib/python2.7/site-packages/Django-1.3.3-py2.7.egg/django/conf/init.py", line 142, in init logging_config_func(self.LOGGING) File "/usr/local/lib/python2.7/logging/config.py", line 777, in dictConfig dictConfigClass(config).configure() File "/usr/local/lib/python2.7/logging/config.py", line 562, in configure 'filter %r: %s' % (name, e)) ValueError: Unable to configure filter 'require_debug_false': Cannot resolve 'django.utils.log.RequireDebugFalse': No module named RequireDebugFalse

I'm not particularly familiar with Django, but perhaps you're seeing the same problem as this post?

It is, indeed, CartRoo.

@CyanPrime, the settings.py you're using is for Django 1.4, and we have Django 1.3.3 installed. You can either switch to using 1.3 for your webapp, or install Django 1.4 into a virtualenv. The third post in the forum thread that Cartroo mentions has some links to get you started.

@glenn: I note that searching on Google for "RequireDebugFalse" throws up PAW as the first hit, which is nice. Next step: get it higher than python.org when searching for "python". (^_^)

@glenn, I already installed 1.4 in a virtual dev, so I guess I'm somehow using 1.3 again. How do I make my settings.py in my project use 1.4?

You need to switch into your virtualenv before you run manage.py. In a bash shell, run

source <virtualenv directory>/bin/activate

This will modify your path so you use the Python and the modules from the virtualenv. You should also see that your prompt indicates the virtualenv that is active and your manage.py call will use the Django in the virtualenv.

I create tabled by syncdb, but

DatabaseError at /hoge no such table:

Hi shinriyo, that sounds like quite a different issue from the one at the beginning of this thread...

Still, can you post more information? Can we see the full traceback? And your DATABASES entry in settings.py?