openwisp 2网络拓扑
openwisp-network-topolog的Python项目详细描述
openwisp 2网络拓扑模块(使用python和django web框架构建)。
目录:
从pypi安装稳定版本
从pypi安装:
pip install openwisp-network-topology
安装开发版本
安装皮球:
pip install https://github.com/openwisp/openwisp-network-topology/tarball/master
或者,您也可以使用git:
pip install -e git+git://github.com/openwisp/openwisp-network-topology#egg=openwisp-network-topology
如果您想参与,请安装克隆的fork:
git clone git@github.com:<your_fork>/openwisp-network-topology.git
cd openwisp-network-topology
python setup.py develop
安装(在现有Django项目中集成)
^ settings.py中的{tt1}$应该如下所示(顺序很重要):
INSTALLED_APPS=['django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles',# for customized openwisp admin theme'openwisp_utils.admin_theme',# all-auth'django.contrib.sites','allauth','allauth.account','allauth.socialaccount',# openwisp2 modules'openwisp_users','openwisp_network_topology','rest_framework',# admin'django.contrib.admin',]EXTENDED_APPS=('django_netjsongraph',)
注意EXTENDED_APPS可能包含其他名称(如果您安装了其他模块),在这种情况下,您应该只添加django_netjsongraph。
将openwisp_utils.staticfiles.DependencyFinder添加到设置中的STATICFILES_FINDERS。py
STATICFILES_FINDERS=['django.contrib.staticfiles.finders.FileSystemFinder','django.contrib.staticfiles.finders.AppDirectoriesFinder','openwisp_utils.staticfiles.DependencyFinder',]
将openwisp_utils.loaders.DependencyLoader添加到TEMPLATES中的settings.py
TEMPLATES=[{'BACKEND':'django.template.backends.django.DjangoTemplates','DIRS':[],'OPTIONS':{'loaders':['django.template.loaders.filesystem.Loader','django.template.loaders.app_directories.Loader','openwisp_utils.loaders.DependencyLoader',],'context_processors':['django.template.context_processors.debug','django.template.context_processors.request','django.contrib.auth.context_processors.auth','django.contrib.messages.context_processors.messages',],},},]
将以下设置添加到settings.py
LOGIN_REDIRECT_URL='admin:index'ACCOUNT_LOGOUT_REDIRECT_URL=LOGIN_REDIRECT_URL
将url添加到主urls.py:
fromdjango.conf.urlsimportinclude,urlfromdjango.contrib.staticfiles.urlsimportstaticfiles_urlpatternsfromopenwisp_utils.admin_theme.adminimportadmin,openwisp_adminopenwisp_admin()urlpatterns=[url(r'^',include('openwisp_network_topology.urls')),url(r'^admin/',include(admin.site.urls)),]urlpatterns+=staticfiles_urlpatterns()
然后运行:
./manage.py migrate
安装以进行开发
安装sqlite:
sudo apt-get install sqlite3 libsqlite3-dev
安装分叉回购:
git clone git://github.com/<your_fork>/openwisp-network-topology
cd openwisp-network-topology/
python setup.py develop
安装测试要求:
pip install -r requirements-test.txt
创建数据库:
cd tests/
./manage.py migrate
./manage.py createsuperuser
将settings.py中的EMAIL_PORT设置为端口号(例如:1025):
EMAIL_PORT='1025'
启动开发服务器和SMTP Deubgging服务器:
./manage.py runserver
# open another session and run
python -m smtpd -n -c DebuggingServer localhost:1025
您可以在http://127.0.0.1:8000/admin/访问管理接口。
使用以下命令运行测试:
./runtests.py
贡献
- 在OpenWISP Mailing List中宣布你的意图 并使用issue tracker 打开相关问题
- 派生此repo并按照instructions 安装项目
- 跟随PEP8, Style Guide for Python Code
- 编写代码和相应的测试
- 确保所有测试都通过,并且测试覆盖率不会降低
- 记录您的更改
- 发送拉取请求
更改日志
见CHANGES。
许可证
见LICENSE。