Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Feb 26, 2021. It is now read-only.
/python-vuejsPublic archive

Commitbc08524

Browse files
author
cstrap
committed
init djangofy vue.js
1 parenta8f7f3a commitbc08524

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

‎python_vuejs/django.py‎

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
11
# -*- coding: utf-8 -*-
2+
from __future__importabsolute_import,division,print_function
23

34
importclick
5+
importos
46

57

68
@click.command()
7-
defdjan(args=None):
8-
"""Console script for python_vuejs"""
9-
click.echo("Replace this message by putting your code into "
10-
"python_vuejs.cli.main")
11-
click.echo("See click documentation at http://click.pocoo.org/")
9+
@click.argument('project')
10+
defdjangobuild(project):
11+
"""
12+
Called inside `package.json`
13+
"""
14+
template_file='templates/{project}/index.html'.format(project=project)
15+
withopen(template_file,"r+")asf:
16+
lines=f.readlines()
17+
f.seek(0)
18+
lines.insert(0,"{% load staticfiles %}\n")
19+
forlineinlines:
20+
f.write(line.replace('href=/',"href={% static '/")
21+
.replace('.css',".css' %}")
22+
.replace('src=/',"src={% static '/")
23+
.replace('.js',".js' %}"))
24+
25+
26+
@click.command()
27+
@click.argument('project')
28+
defdjangofy(project):
29+
"""
30+
Convert Vue.js webpack project into a django app
31+
"""
32+
os.makedirs('{project}/templates/{project}/'.format(project=project))
33+
# TODO:
34+
# create urls.py
35+
# create __init__.py
36+
# create empty index.html under templates/project
37+
# edit `index.json` build
38+
# edit `package.json` build

‎setup.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
'vuecli=python_vuejs.vuejs:install_vue_cli',
3838
'startvueapp=python_vuejs.vuejs:startvueapp',
3939
'startvueapp=python_vuejs.vuejs:vuedev',
40+
'djangobuild=python_vueks.django:djbuild',
41+
'djangofy=python_vuejs.django:djvue',
4042
]
4143
},
4244
include_package_data=True,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp