Giter VIP home page Giter VIP logo

websauna's Introduction

Websauna is a full stack Python web framework for building web services and back offices with admin interface and sign up process.

Supported Python versions Latest Version License
ci cov  

https://websauna.org/theme/images/logo-768.png

Websauna is a Python web framework for developing highly customized consumer and business websites and backends. It emphasises a low learning curve, community friendliness and polished documentation, so that newcomer developers get their first release out quickly. This is done without sacrificing scalability and high maintainability for more complex websites. Websauna builds its foundation on best practices and innovation that web development and Python communities have been refining for the last 20 years.

Websauna is created with modern Python 3 features, Pyramid web routing framework and SQLAlchemy object relational mapping. You get out of the box user experience with Jinja templates and Bootstrap theming, but you are free to bring in your own frontend.

Software development is only half of the story. Websauna additionally provides a basic deployment and operations story based on Ansible automation.

Websauna is focused on Internet facing sites where you have a public or private sign up process and an administrative interface. Its sweet spots include custom business portals and software-as-a-service products which are too specialized for off-the-shelf solutions. Websauna is ideal for Internet startups that iterate fast and may face urgent scalability needs. Furthermore, you can easily integrate different frontends like React, Angular and mobile apps with Websauna back office.

Websauna application comes with default admin interface and user sign up. You can start immediately developing business logic by adding models, views, forms and CRUD controllers.

Polished integration, getting started tutorial and project scaffolding allow a seasoned Python developer to roll out a custom web service within few a hours - being a turn key solution for the first prototype that can later be iterated on.

Websauna default stack choices are made high scalability in mind, so that your website can reach millions of users before you start hitting limitations. For example, delayed and asynchronous tasks ensure your site stays responsive and can scale horizontally.

Websauna is a security first solution . Its foundation principles make it immune to OWASP top 10 vulnerabilities. Websauna leans heavily on optimistic concurrency control eliminating potential for race condition errors. ACID guarantees are followed throughout the codebase, making Websauna ideal for financial services needing high data integrity.

A default mobile friendly Bootstrap frontend is provided for landing page and form styling. You can drop in premium theme packages for distinct user experience even if there is graphical design talent in your team. Federated authentication, like Facebook or Google login, is supported out of the box. Building RESTful behavior over business logic is made easy, so that frontend may be replaced with a heavier JavaScript solution when needed.

All default stack choices are suggestive, thus leaving room for opinions for different components and a path to scale up a service. There is no inversion of control - the developer is always in the driver's seat. A strong decoupling is achieved through component architecture, event dispatch and standardized addon mechanism. This allows building non-monolithic packages and frictionless distribution of work among teams.

You can browse available addons on Github.

A significant part of software development work is maintaining and updating services. Websauna provides a default deployment story using Ansible. When your website is ready to go live, you point the Ansible playbook to any Linux installation and it will deploy a fully functional website within a few minutes. The deployment choices are made by security experts for your convenience, so that even without deep sysadmin knowledge you can run your sites securely.

Because Websauna uses vendor neutral Ansible playbooks, you are not tied to a particular provider. Migrating between service providers is easy. You can run Websauna on Amazon, Azure, Hetzner, Digital Ocean, Linode, Upcloud or any other cloud server provider.

Websauna comes with integrated IPython Notebook support. IPython Notebook, an award winning data analysis and science tool, is directly integrated into Websauna. You can open a browser based shell prompt within your admin site with one click.

The IPython integration makes Websauna ideal for science and data analysis use cases. You can also use the administrative shell for ad hoc system administration tasks and data fixes.

websauna's People

Contributors

arianmaykon avatar enkidulan avatar ericof avatar frispete avatar hieuh25 avatar imbilltucker avatar janlikar avatar jsbueno avatar kissgyorgy avatar koirikivi avatar lelit avatar livike avatar maikroeder avatar mazz avatar miohtama avatar mklappir avatar ooduor avatar petri avatar rmoorman avatar rudaporto avatar slav0nic avatar stevepiercy avatar tareqalam avatar tomster avatar witsch avatar ztane avatar zupo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

websauna's Issues

Incorect location of alembic migrations folder

When following tutorial instructions getting this error:

FAILED: Path doesn't exist: 'alembic'.  Please use the 'init' command to create a new scripts folder.

The reason is that app scaffold puts alembic migrations on same level with setup.py, but from instructions it seems that desired location for executing commands ( ws-alembic) is a module root - the same level as conf folder.

Probably the right solution for this issue would be to make ws-alembic folder context independent by forcing it(and users as well) to have alembic migrations on module level root (same level where conf folder lives)

TinyMCE not working on production

Works fine on localhost:
localhost

Broken on production:
live

The deform snippet rendering tinyMCE:

    includes = [
        "page_title",
        "page_status",
        "parent",
        colander.SchemaNode(colander.String(),
                            name="page_content",
                            validator=validate_json,
                            widget=deform.widget.RichTextWidget(options=(('browser_spellcheck', True),
                                                                         ('images_reuse_filename', True),
                                                                         ('automatic_uploads', True),
                                                                         ('images_upload_url', 'uploads/rte_images'),
                                                                         ('selector', "textarea"),
                                                                         ('plugins', ("advlist autolink lists link image charmap print preview anchor", "searchreplace visualblocks code fullscreen", "insertdatetime media table contextmenu paste")),
                                                                         ('toolbar', 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image'),
                                                                         ('file_browser_callback', 'function(field_name, url, type, win) { win.document.getElementById(field_name).value = \'my browser value\';}'),
                                                                ),
                                                                css_class="editor")),

The 404 console errors on the live application show some plugin.js and theme.js not being found.

tutorial_10: talk about websauna's template context variables

In the question.html template, the uuid_to_slug filter is used without being explicitly supploed as an argument. Even though this is probably obvious to anyone who has worked with Jinja2 before, in my opinion it would be good to talk about the fact that Websauna injects some variables and filters into the templates, and perhaps add a direct link to the relevant documentation section.

documentation: hosts.ini for ansible >=2 (ansible_ssh_user vs ansible_user)

ansible_ssh_user becomes ansible_user in ansible 2.0 (see ansible documentation note).

The Websauna documentation uses ansible_ssh_user.

Using the example hosts.ini in ansible 2.1.0.0

[default]
myapp_production ansible_ssh_host=21.246.56.179 ansible_ssh_user=ubuntu www_ip=21.246.56.179

results in an error when running a playbook:

$ ansible-playbook -i hosts.ini playbook-myapp.yaml 

[...]

TASK [websauna.ssh : Make sure we give rights to SSH_AUTH_SOCK on wsgi user on interactive SSH login] ***
fatal: [myapp_production]: FAILED! => {"failed": true, "msg": "'ansible_user' is undefined"}

That error is solved by using the newer configuration variables' format (ansible_host and ansible_user).

tutorial_02: installing-dependencies-on-osx ->DOC: python version

Which is the min required version of python?
If 3.4 then change the change the python 3.5 related example codes or change the explanation text to be unambiguous.

The brew switch python3 python3.5.0 from the docs was not functional for me
needed to update the version and update the link like this:

brew upgrade python3
brew link —overwrite python3

tutorial_02:installing-websauna-python-package->DOC virtualenvwrapper

Add in documentation example code for virtualenwrapper in case the user already uses it.


# This creates venv folder with Python environment for your project
mkvirtualenv --python=/usr/local/bin/python3 myenv

# This will activate the environment for your current shell session
workon myenv

TypeError: IContainer.items return value

I think this is a bug. So in the interfaces we have IContainer interface that has items method which should return Iterable[Tuple[str, ILocation]] but when we test this in sitemapsamples.SampleContainer we expect Iterable[Tuple].

code:
https://github.com/websauna/websauna/blob/master/websauna/system/core/interfaces.py#L70
tests:
https://github.com/websauna/websauna/blob/master/websauna/tests/sitemapsamples.py#L31

error:

Traceback (most recent call last):
  File "/Users/karantan/github/tmp/venv/bin/ws-create", line 11, in <module>
    load_entry_point('websauna', 'console_scripts', 'ws-create')()
  File "/Users/karantan/github/tmp/venv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 561, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/Users/karantan/github/tmp/venv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2627, in load_entry_point
    return ep.load()
  File "/Users/karantan/github/tmp/venv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2287, in load
    return self.resolve()
  File "/Users/karantan/github/tmp/venv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2293, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/Users/karantan/github/websauna/websauna/system/__init__.py", line 5, in <module>
    from websauna.system.mail.utils import create_mailer
  File "/Users/karantan/github/websauna/websauna/system/mail/__init__.py", line 13, in <module>
    from websauna.system.http import Request
  File "/Users/karantan/github/websauna/websauna/system/http/__init__.py", line 9, in <module>
    from websauna.system.admin.admin import Admin
  File "/Users/karantan/github/websauna/websauna/system/admin/admin.py", line 9, in <module>
    from websauna.system.core.root import Root
  File "/Users/karantan/github/websauna/websauna/system/core/root.py", line 2, in <module>
    from websauna.system.core.interfaces import IRoot
  File "/Users/karantan/github/websauna/websauna/system/core/interfaces.py", line 22, in <module>
    class IContainer(ILocation):
  File "/Users/karantan/github/websauna/websauna/system/core/interfaces.py", line 70, in IContainer
    def items() -> Iterable[Tuple[str, ILocation]]:
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/typing.py", line 696, in __getitem__
    parameters = tuple(_type_check(p, msg) for p in parameters)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/typing.py", line 696, in <genexpr>
    parameters = tuple(_type_check(p, msg) for p in parameters)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/typing.py", line 299, in _type_check
    raise TypeError(msg + " Got %.100r." % (arg,))
TypeError: Tuple[t0, t1, ...]: each t must be a type. Got <InterfaceClass pyramid.interfaces.ILocation>.

Can someone check if this is truly a bug or am I doing something wrong.

i18n

For translating Websauna projects

  • Provide toolchain
  • Provide documentation
  • Have default templates translated

[Feature] Allow use of translations (i18n)

I know this can already be some planned feature, but it would be nice to have support for translations.

I have 3 more questions to add (not necessarily related and not necessarily right), not sure if i should create issues for them:

  1. [Deform probably supports this, but i'm not sure, i'm new to Python, sorry :P] Allow customization of form (mostly login form) in the sense of buttons/text customization. Now is not possible to use another text on the login button (or translate it);
  2. Allow through configuration the use of different form fields handling (mapping_item.pt), i have a feeling that this does that, but i'm not sure;
  3. Is there any forum or IRC channel (besides #pyramid) where we can discuss and ask questions about Websauna stuff in general?

I also want to give congratulations and thank you guys for this great software, i was astonished by the power an agility of it. It reminds me of some other great software i had used on another communities.

Thanks.

tutorial_08:playing-with-the-model-api-> DOC datetime

The function is_recent() is getting an error because the datetime: "NameError: name 'datetime' is not defined"
I solved this by importing the datetime: from websauna.utils.time import datetime, now

However during the error I can see in notebook session the datetime object...

Docs: sphinx can't get objects.inv

Sphinx can't get objects.inv from websauna's docs (403 error). If you point the browser at
https://websauna.org/docs/objects.inv you can download the file without problems.

ws-db-shell throws FileNotFoundError

$ ws-db-shell conf/development.ini
Connecting to Engine(postgresql://localhost/myapp)
Traceback (most recent call last):
  File "/Users/walkman/Learning/websauna/venv/bin/pgcli", line 9, in <module>
    load_entry_point('pgcli', 'console_scripts', 'pgcli')()
  File "/Users/walkman/Learning/websauna/venv/lib/python3.5/site-packages/click-6.3-py3.5.egg/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/Users/walkman/Learning/websauna/venv/lib/python3.5/site-packages/click-6.3-py3.5.egg/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/Users/walkman/Learning/websauna/venv/lib/python3.5/site-packages/click-6.3-py3.5.egg/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/walkman/Learning/websauna/venv/lib/python3.5/site-packages/click-6.3-py3.5.egg/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Users/walkman/Learning/websauna/venv/lib/python3.5/site-packages/pgcli-0.20.1-py3.5.egg/pgcli/main.py", line 569, in cli
    pgcli = PGCli(prompt_passwd, never_prompt, pgclirc_file=pgclirc)
  File "/Users/walkman/Learning/websauna/venv/lib/python3.5/site-packages/pgcli-0.20.1-py3.5.egg/pgcli/main.py", line 87, in __init__
    write_default_config(default_config, pgclirc_file)
  File "/Users/walkman/Learning/websauna/venv/lib/python3.5/site-packages/pgcli-0.20.1-py3.5.egg/pgcli/config.py", line 26, in write_default_config
    shutil.copyfile(source, destination)
  File "/Users/walkman/Learning/websauna/venv/lib/python3.5/shutil.py", line 115, in copyfile
    with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/walkman/.config/pgcli/config'

Do you have any idea?

I have heavy symlink usage in my home directory, this might cause the problem, but still should be able to start.

Error while installing websauna on ubuntu 16.04

while following instructions to install websauna,
i tried to install but was unable to complete because of a missing dependency

a quick look by your friend
Sivan Greenberg
and he found out the package missing is:
libffi-dev

after running:
sudo apt-get install libffi-dev

the install could complete successfully.

Unavailable scaffolds: websauna_app with pcreate after clean install

After installing websauna, and running pcreate, this is what I got:

(venv) $ pcreate -t websauna_app myapp
Warning: could not load entry point websauna_app (InvalidRequirement: Invalid requirement, parse error at "'; sys.pl'")
Warning: could not load entry point websauna_addon (UnknownExtra: ipython 3.2.3 has no such extra feature 'notebook')
Unavailable scaffolds: websauna_app

I installed from github with pip:
(venv) $ pip install "git+ssh://github.com/websauna/websauna.git@master#egg=websauna"

Don't require manual CREATE EXTENSION IF NOT EXISTS "uuid-ossp"

Currently when running Websauna on PSQL database you want to use uuid-ossp extension for UUID column. However to get this support for the database one needs to run command:

  psql -c 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; CREATE EXTENSION IF NOT EXISTS "postgis";' mydbname

This is an unnecessary manual step. Websauna should come with prepopulated Alembic migration script that does this as the initial Alembic migration.

ws-sync-db command already does this for you.

However one needs to check for the database type, as this won't work on SQLite.

Cut down dependencies

Currently IPython is pulling in tons of dependencies which might or might not be useful.

Many users find this as extra truckload of crap.

Make IPython installation optional and have graceful errors telling users "no you cannot use autocomplete shell" if IPython is not installed.

Documentation: Postgres installation

Perhaps you could add a section to installation notes how to install Websauna with a Dockerized
Postgres installation for the sake of making the initial setup less painless. Although the Postgres installation and setup is not that hard but it requires some manual steps. A setup with a well-defined Postgres Docker image might help here.

tutorial_02:installing-application-package->DOC specify paths for running the commands

Add in the doc before the command codes to be run the exact directory from where must be runned.
For these commands:
pip install -e "myapp[test]” (runs only from the project directory)
pip install -e "myapp[utils]”
ws-db-shell myapp/conf/development.ini
for the ws-db-shell I had an error and needed to run the pip install websauna[utils]

Makefile for devs

On the plone.api project we have had a Makefile for bootstrapping the dev environment and it is (in my view) probably one of the main reason why plone.api was able to be a community project and not a single-person-project almost from the start.

Shall we have the same for Websauna?

pyramid_mailer doesn't like Celery

pyramid_mailer assumes thread local transaction manager. This does not work with Celery. You cannot rely on commit hook to send out email, because it's using wrong transaction manager.

See send_templated_mail() for the current workaround.

Consistently use single or double queotes

I'm not sure if this is on purpose but somewhere single quotes are used for strings and somewhere there are double quotes.

IMO it makes sense to use only single or only double quotes. Thoughts?

tutorial_10: decode_uuid does not exist

At tutorial_10, we are told to import the function websauna.system.core.route.decode_uuid() which does not exist and which is supposedly a predicate. I managed to make it work by not using decode_uuid(), and changing the function to the following:

import slug_to_uuid

@simple_route("/questions/{question_uuid}",
              route_name="detail",
              renderer="myapp/detail.html")
def detail(request: Request):
    question_uuid = slug_to_uuid(request.matchdict['question_uuid'])
    question = request.dbsession.query(Question).filter_by(uuid=question_uuid).first()
    if not question:
        raise HTTPNotFound()
    return dict(question=question)

I will not submit a pull request because I'm not sure what the example was trying to accomplish (I'm not familiar with pyramid route predicates yet), and this is just a simple workaround.

tutorial_10: error in detail.html

rendering of the 'myapp/detail.html' template fails with the following error:

jinja2.exceptions.UndefinedError: 'myapp.models.Question object' has no attribute 'choice_set'

I guess this is because the Question class attributes have been changed, and choice_set is now choices. My git archeology skills are not good enough to search for the changeset in which this was changed.

Wrong view block used on doc and admin

Docs and admin sub-templates are using a custom_script block when the correct block name on base.html is the extra_body_end.

Check the files below:

docs/source/narrative/crud/admin.rst
docs/source/narrative/frontend/javascript.rst
websauna/system/admin/templates/admin/admin.html
websauna/system/admin/templates/admin/base.html
websauna/system/core/templates/site/base.html

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.