公式チュートリアルの後にカスタムDjangoアプリケーションをビルドしてインストールしましたhttps://docs.djangoproject.com/en/1.8/intro/reusable-apps/カスタムDjangoアプリケーションコードはどこにありますか?
インストールが成功したようです。
$ pip install --user ../horizon2fa-0.1.tar.gz
Processing /opt/stack/horizon2fa-0.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): horizon2fa==0.1 from file:///opt/stack/horizon2fa-0.1.tar.gz in /opt/stack/.local/lib/python2.7/site-packages
Building wheels for collected packages: horizon2fa
Running setup.py bdist_wheel for horizon2fa ... done
Stored in directory: /opt/stack/.cache/pip/wheels/a6/4a/f0/4533f85d90b8f1a274a35d3865a2e0b15ff85f0570a0708679
Successfully built horizon2fa
私のカスタムクラスとメソッドのソースコードはどこにありますか?
システムから検索しようとしましたが見つかりませんでした。コードはコンパイルされていますか?
$ sudo find/-name "*horizon2fa*"
/root/.cache/pip/wheels/a0/9d/24/d8070ea2a01759ce7ebc03c34393db8a5aceccd380e60481c5/horizon2fa-0.1-cp27-none-any.whl
/opt/stack/.cache/pip/wheels/a6/4a/f0/4533f85d90b8f1a274a35d3865a2e0b15ff85f0570a0708679/horizon2fa-0.1-cp27-none-any.whl
/opt/stack/.local/lib/python2.7/site-packages/horizon2fa-0.1.dist-info
/opt/stack/horizon2fa-0.1.tar.gz
モジュールが正しくインストールされていないようです。
python -c "import horizon2fa; print(horizon2fa.__path__)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named horizon2fa
以下、私のアプリケーションのディレクトリ構造を見ることができます。
[email protected]:~/Development/openstack2FA/horizon2fa$ tree
.
├── admin.py
├── dist
│ └── horizon2fa-0.1.tar.gz
├── enabled
│ └── _31000_myplugin.py
├── horizon2fa.egg-info
│ ├── dependency_links.txt
│ ├── PKG-INFO
│ ├── SOURCES.txt
│ └── top_level.txt
├── __init__.py
├── LICENSE
├── main.py
├── MANIFEST.in
├── migrations
│ ├── 0001_initial.py
│ └── __init__.py
├── models.py
├── panel.py
├── README.rst
├── setup.py
├── templates
│ ├── base.html
│ └── horizon2fa
│ ├── created.html
│ ├── index.html
│ ├── login.html
│ ├── new.html
│ └── view.html
├── tests.py
├── urls.py
├── user.py
└── views.py
私のsetup.pyスクリプト。
import os
from setuptools import find_packages, setup
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='horizon2fa',
version='0.1',
packages=find_packages(),
include_package_data=True,
license='BSD License', # example license
description='A Django app.',
long_description=README,
url='http://www.trex.com/',
author='trex',
author_email='[email protected]',
classifiers=[
'Environment :: Web Environment',
'Framework :: Django',
'Framework :: Django :: X.Y', # replace "X.Y" as appropriate
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License', # example license
'Operating System :: OS Independent',
'Programming Language :: Python',
# Replace these appropriately if you are stuck on Python 2.
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
)
'/ opt/stack/.local/lib/python2.7/site-packages'にはありませんか? – doru
明らかにLinux(または他のUNIXスタイルのOS)を使用しているので、インストールパスはおそらく '/ usr/local/lib/{{あなたのpythonのバージョン}}/site-packages'です。これは少なくともDebianベースのシステム下の場所です。 – cezar
サイトパッケージにソースコードが表示されません。 ls -lh /opt/stack/.local/lib/python2.7/site-packages/horizon2fa-0.1.dist-info/ 合計28K -rw-rw-r-- 1 stack stack 15 Feb 25 09:38説明。先頭へ -rw-rw-r-- 1スタックスタック2月25日09:38 INSTALLER -rw-rw-r-- 1スタックスタック905 Feb 25 09:38メタデータ -rw-rw-r-- 1スタックstack 967 Feb 25 09:38 metadata.json -rw-rw-r-- 1スタックスタック735 Feb 25 09:38 REC -rw-rw-r--スタックスタック11 Feb 25 09:38 top_level.txt -rw-rw-r-- 1スタックスタック93 Feb 25 09:38 WHEEL – trex