简体   繁体   中英

How can I set up Debian x86_64 so a Django project sees django.contrib.staticfiles?

I have a new Debian VPS, and a Django project that I am trying to deploy is not seeing django.contrib.staticfiles.*. Doing a "pip install django-staticfiles" has not observably changed things.

What is the best way to have things running well enough that such Django projects will run?

--EDIT--

I tried to uninstall Django and then install with pip and a virtualenv. This resulted in another error, failing to import execute_manager. The terminal output was:

Proceed (y/n)? y
  Successfully uninstalled gunicorn
root@ps306627:/home/cjsh/pragmatometer# exit
(pragmatometerenvironment)cjsh@ps306627:~/pragmatometer$ pip uninstall django
Uninstalling Django:
  /home/cjsh/pragmatometerenvironment/bin/django-admin.py
  /home/cjsh/pragmatometerenvironment/lib/python2.6/site-packages/Django-1.6.3-py2.6.egg-info
  /home/cjsh/pragmatometerenvironment/lib/python2.6/site-packages/django
Proceed (y/n)? y
  Successfully uninstalled Django
(pragmatometerenvironment)cjsh@ps306627:~/pragmatometer$ pip install django
Downloading/unpacking django
  Downloading Django-1.6.3.tar.gz (6.6Mb): 6.6Mb downloaded
  Running setup.py egg_info for package django
    warning: no previously-included files matching '__pycache__' found under directory '*'
    warning: no previously-included files matching '*.py[co]' found under directory '*'
Installing collected packages: django
  Running setup.py install for django
    changing mode of build/scripts-2.6/django-admin.py from 644 to 755
    warning: no previously-included files matching '__pycache__' found under directory '*'
    warning: no previously-included files matching '*.py[co]' found under directory '*'
    changing mode of /home/cjsh/pragmatometerenvironment/bin/django-admin.py to 755
Successfully installed django
Cleaning up...
(pragmatometerenvironment)cjsh@ps306627:~/pragmatometer$ pip install gunicorn
Downloading/unpacking gunicorn
  Downloading gunicorn-18.0.tar.gz (366Kb): 366Kb downloaded
  Running setup.py egg_info for package gunicorn
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'examples'
    warning: no previously-included files matching '*.pyo' found under directory 'examples'
Installing collected packages: gunicorn
  Running setup.py install for gunicorn
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'examples'
    warning: no previously-included files matching '*.pyo' found under directory 'examples'
    Installing gunicorn_paster script to /home/cjsh/pragmatometerenvironment/bin
    Installing gunicorn script to /home/cjsh/pragmatometerenvironment/bin
    Installing gunicorn_django script to /home/cjsh/pragmatometerenvironment/bin
Successfully installed gunicorn
Cleaning up...
(pragmatometerenvironment)cjsh@ps306627:~/pragmatometer$ python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 2, in <module>
    from django.core.management import execute_manager
ImportError: cannot import name execute_manager

Thanks,

What I saw was irritation at a manage.py that was out of sync with the newer version of python the system was running.

The new, working manage.py, with old one commented out, is:

#!/usr/bin/env python
import os, sys

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pragmatometer.settings")
    from django.core.management import execute_from_command_line
    execute_from_command_line(sys.argv)
##!/usr/bin/env python
#from django.core.management import execute_manager
#import imp
#try:
#    imp.find_module('settings') # Assumed to be in the same directory.
#except ImportError:
#    import sys
#    sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
#    sys.exit(1)
#
#import settings
#
#if __name__ == "__main__":
#    execute_manager(settings)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM