forked from redecentralize/alternative-internet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preload and render list of project names
- Loading branch information
Showing
10 changed files
with
34 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
from flask import Flask | ||
app = Flask(__name__) | ||
|
||
from alternative_internet.data import preload_datafiles | ||
preload_datafiles() | ||
|
||
import alternative_internet.views |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import os | ||
|
||
|
||
PROJECT_ROOT = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir, os.pardir)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import os | ||
import glob | ||
import json | ||
|
||
from slugify import slugify | ||
|
||
import alternative_internet.config as config | ||
|
||
DATABASE = {} | ||
SORTED_NAMES = [] | ||
|
||
def preload_datafiles(): | ||
for filename in glob.glob(os.path.join(config.PROJECT_ROOT, 'projects/*.json')): | ||
blob = json.loads(open(filename, 'r').read()) | ||
DATABASE[slugify(blob['name'])] = blob | ||
SORTED_NAMES.append(blob['name']) | ||
SORTED_NAMES.sort() | ||
|
||
def get_names(): | ||
return SORTED_NAMES |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
from alternative_internet import app | ||
from alternative_internet import data as db | ||
|
||
@app.route('/') | ||
def index(): | ||
return 'Hello World!' | ||
s = '<br/>'.join(db.get_names()) | ||
return s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"name": "The Decentralized Library of Alexandria", | ||
"description": "The [Decentralized Library of Alexandria](http://dloa.net/) is an open-source standard in active development to allow users to publish and distribute original content themselves, from music to videos to feature films, 3d printable inventions, recipes, books and just about anything else.", | ||
"description": "The [Decentralized Library of Alexandria](http://dloa.net/) is an open-source standard in active development to allow users to publish and distribute original content themselves, from music to videos to feature films, 3d printable inventions, recipes, books and just about anything else." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
{ | ||
"name": "MORPHiS", | ||
"description": "[MORPHiS](https://morph.is/) is a global encrypted distributed datastore intended to replace the cloud for storage and far more. Free open source peer-to-peer | ||
high-performance distributed datastore." | ||
"ohloh": { | ||
"skip": true | ||
} | ||
"description": "[MORPHiS](https://morph.is/) is a global encrypted distributed datastore intended to replace the cloud for storage and far more. Free open source peer-to-peer high-performance distributed datastore." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
Flask==0.10.1 | ||
Flask==0.10.1 | ||
python-slugify==1.2.0 |