Git Product home page Git Product logo

packpng-1's Introduction

packpng.com rewrite

Coverage Status Build Status

because the original page was made in a website builder

how to run

you need a recent python 3, i tested on 3.8.0

first install requirements pip install -r requirements.txt

run file python run.py

now you can access the page on localhost. the server will restart if it detects changes in existing files.

directory structure

packpng/
├───app/                    main code files
│   ├───static/             static files such as css, js, images
│   │   ├───gallery/        gallery images
│   │   └───thumbnails/     thumbnails for the gallery images
│   └───templates/          jinja2 templates
├───data/                   json and other data files, used for templates
└───tests/                  tests folder

writing templates/pages.

you have to add a path to the page in app/main.py. the basic structure of this is

@main_blueprint.route("/mypage") # the path to the page
def mypage(): # function doesnt have to be the same name as route
    a = [1,2,3] # example variable
    return render_template("mypage.html", a=a) # render the template named "mypage.html" from the templates folder, and pass the value of "a" with the name "a" to the template

related flask quickstart

then you have to add the page to the navbar, if it should appear there. go to app/templates/layout.html and look at the top of the file. add a new element to the list like this ('main_blueprint.mypage', 'mypage', 'My Page'),, the first string is the name of the python function + blueprint, the second the arbitrary name used to set the active navbar page, and the last the display name.

make sure to set the correct active page in your template using {% set active_page = "mypage" %}. here we use the arbitrary name we defined before

link to pages with {{ url_for('blueprint.function') }} and to static files with {{ url_for('static', filename='pack.png') }}

Pushing Updates

Make a pull request into the "deploy" branch.

Then the server should grab the changes from the deploy branch and restart, once the pull request is accepted/merged.

Do not deploy too often, and make sure that all tests have run before merging!

packpng-1's People

Contributors

laundmo avatar srs2225a avatar b50corei5 avatar schicho avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.