Skip to content

Commit

Permalink
Update npm dependencies, switch to Pipenv, rebase install.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Vic Shóstak committed Jan 16, 2018
1 parent 23b1eb0 commit f248358
Show file tree
Hide file tree
Showing 8 changed files with 407 additions and 232 deletions.
18 changes: 18 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"


[packages]

bottle = "*"
bottle-sqlalchemy = "*"
"Jinja2" = "*"
MarkupSafe = "*"
SQLAlchemy = "*"


[dev-packages]

63 changes: 63 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![bottle-vue-kickstart-main](https://cloud.githubusercontent.com/assets/11155743/24041455/9fbd99ec-0b1e-11e7-9ba0-a429a28591b0.jpg)

# Very basic kickstart Bottle kit with Vue.js
[![GitHub release](https://img.shields.io/badge/version-0.4.1-brightgreen.svg?style=flat-square)](https://github.com/koddr/bottle-vue-kickstart) [![licence](https://img.shields.io/badge/Python-2.7_or_3.4+-red.svg?style=flat-square)](https://www.python.org/downloads/) [![licence](https://img.shields.io/badge/licence-MIT-blue.svg?style=flat-square)](https://github.com/koddr/bottle-vue-kickstart/blob/master/LICENSE.md)
[![GitHub release](https://img.shields.io/badge/version-0.4.2-brightgreen.svg?style=flat-square)](https://github.com/koddr/bottle-vue-kickstart) [![licence](https://img.shields.io/badge/Python-2.7_or_3.4+-red.svg?style=flat-square)](https://www.python.org/downloads/) [![licence](https://img.shields.io/badge/licence-MIT-blue.svg?style=flat-square)](https://github.com/koddr/bottle-vue-kickstart/blob/master/LICENSE.md)

Simplify development of reactive web applications on [Bottle](http://bottlepy.org/) – lightweight WSGI micro web-framework for Python! A simple process of installing and deploying. Everything has already been done for you. Just enjoy writing your code!

Expand Down Expand Up @@ -33,16 +33,19 @@ $ npm install && npm run build

Third, prepare your virtual environment:

Since `0.4.2` we use [Pipenv](https://github.com/pypa/pipenv) project for manage virtual environments.

```bash
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install pipenv
```

Next, install Bottle and all extensions:
> More info here: https://packaging.python.org/tutorials/managing-dependencies/#managing-dependencies
Next, install Bottle with all extensions and go to your environment shell:

```bash
(venv) $ pip install -r requirements.txt
(venv) $ deactivate
$ pipenv install
$ pipenv shell
```

Finally, run development server:
Expand All @@ -63,7 +66,7 @@ Hit Ctrl-C to quit.
(Optional) Install database with example objects:
```bash
$ python3 install.py
$ python3 _devtools/install_init_database.py
```
Now, your yellow section on http://localhost:8080/ will look like this:
Expand All @@ -75,6 +78,8 @@ And we done!
## Final app structure
``` html
├── _devtools
│   └── install_init_database.py
├── static
│   ├── assets
│   │   ├── js
Expand All @@ -92,9 +97,8 @@ And we done!
│   └── layout
│   └── base.html
├── articles.db
├── install.py
├── package.json
├── requirements.txt
├── Pipfile
├── run.py
└── webpack.config.js
```
Expand Down
9 changes: 6 additions & 3 deletions install.py → _devtools/install_init_database.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Import Python packages
import os.path, sqlite3
import os, sqlite3

# Define DB file
db_file = 'articles.db'

# Check if database file `articles.db` already exist
if os.path.isfile('articles.db'):
if os.path.isfile(db_file):
# If exist...
# Print error message
print('[ERROR] Database file already exists. Delete them first and try again.')
else:
# Else...
# Create database `articles`
db = sqlite3.connect('articles.db')
db = sqlite3.connect(db_file)
db.execute(
"CREATE TABLE articles ("
"id INTEGER PRIMARY KEY, "
Expand Down
Loading

0 comments on commit f248358

Please sign in to comment.