Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
基于django构建的开源商城模块,可以快速的应用到自己的项目当中,使得自己的项目可以快速的拥有一个商城模块,使用简单,没有过多的依赖第三方包,非常的轻量,只使用了django+pyecharts+pillow+drf等一些基础的模块库,并实现了商城后台所需要的基本数据分析功能图表。
课程地址:https://www.bilibili.com/cheese/play/ss11391
后台:请按照教程部署,本地访问后台
# 如果配置了国内源,同步不一定及时,这个命令可能安装不是最新版,可改用第二个命令安装
pip install baykeshop
# 保持最新版本请用PYPI的源
pip install baykeshop -i https://pypi.org/simple --upgrade
import baykeshop
INSTALLED_APPS = [
# 'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# 需要依赖站点系统
'django.contrib.sites',
'rest_framework',
*baykeshop.INSTALLED_APPS,
]
# 配置站点系统ID('django.contrib.sites')
SITE_ID = 1
备注:这里我们覆盖了默认的管理站定,默认的管理站点配置需要注释掉或删除,如上所示! rest_framework是django-rest-framework的依赖包,一般安装本项目时会自动跟随安装,直接引入即可,否则需要自行安装。
STATIC_URL = 'static/'
STATIC_ROOT = BASE_DIR / 'static'
MEDIA_URL = 'media/'
MEDIA_ROOT = BASE_DIR / 'media'
'context_processors': [
...
# 添加图片前缀全局变量
'django.template.context_processors.media',
...
],
这里我们不做强制配置,直接使用默认的数据库即可,也可以根据自己需要配置数据库,具体请参考Django官方文档。
这里我们不做强制配置,直接使用默认的缓存即可,也可以根据自己需要配置缓存,具体请参考Django官方文档。
在项目的urls.py文件中,添加如下代码:
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
# django admin
path('admin/', admin.site.urls),
# baykeshop 路由
path('', include('baykeshop.urls')),
# 开发时媒体文件
*static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT),
# 开发时静态文件
*static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
]
注意:这里我们添加了静态文件和媒体文件的配置,是为了方便开发时调试,实际生产环境可以删除。
最好在虚拟环境中运行...
# 生成迁移表
python manage.py makemigrations
# 执行迁移表
python manage.py migrate
# 创建超级用户
python manage.py createsuperuser
# 初始化项目必要配置
python manage.py init
# 启动项目
python manage.py runserver
配置完成后,即可访问!
直接克隆源码到本地,本项目源码采用uv开发,具体开发工具使用请参考官方文档!
运行步骤:
uv sync
cd project
# 生成迁移表
uv run python manage.py makemigrations
# 执行迁移表
uv run python manage.py migrate
# 创建超级用户
uv run python manage.py createsuperuser
# 初始化项目必要配置
uv run python manage.py init
# 启动项目
uv run python manage.py runserver
FAQs
BaykeShop开源商城系统,基于django框架!
We found that baykeshop demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.