[Python] CaveCMS

Status
Not open for further replies.

Bui

Skilled Illusionist
Joined
Jan 18, 2012
Messages
335
Reaction score
119
CaveCMS

This something I've been keen on trying out for quite a while. I'm currently in the process of writing a CMS in Python, so far the name has been decided as CaveCMS. Don't ask why.

I'll be developing this at my own pace: admittedly I do have a lot on my plate at the moment, but this will get done as I slowly progress through it. Once it's in a usable state I'll put up the source on a scm repository, as well as a demo.

CaveCMS uses Flask as its web framework; the variety of extensions as well as Jinja made it a great choice to write the CMS in. For the design, I'll use Bootstrap with the "United" swatch from Bootswatch. I won't be using any (if any) Habbo assets since I want to release the whole thing under an open source license (MIT).

Screenshots so far:
Bui - [Python] CaveCMS - RaGEZONE Forums


Bui - [Python] CaveCMS - RaGEZONE Forums
Not much, I know. The design isn't (currently) something I'm focusing on.

Snippets:
Login view:
Code:
@no_login
@cave.route('/login', methods=['GET', 'POST'])
def login():
    if request.method == 'GET':
        return redirect(url_for('index') + '#login')

    form = LoginForm(request.form)
    if form.validate_on_submit():
        user = User.query.filter_by(username=form.login_username.data).first()
        if user and user.password == hashlib.md5(form.login_password.data).hexdigest():
            login_user(user)
            flash('Welcome back, %s!' % user.username)
            return redirect(url_for('me'))
        flash('Invalid username or password.')
    return render_template('index.html', form=form)
Landing jinja2 template:
Code:
{% extends 'layout.html' %}
{% block title %}Home{% endblock %}
{% block body %}
{% for e in form.errors %}
  {% if e.startswith('login_') %}
    <script type="text/javascript">
      $(document).ready(function(){showLogin();});
    </script> {% break %}
  {% endif %}
{% endfor %}
          <h1>Welcome to {{ config['HOTEL_NAME'] }}!</h1>
          <p>{{ config['HOTEL_NAME'] }} is a free, fun virtual world where you can build your own rooms, chat to your friends, and make new ones!</p>

          {% for flash in get_flashed_messages() %}
          <div class="alert">{{ flash}}
          {% endfor %}

          {% for error in form.errors %}
          <div class="alert alert-error">{{ error }}</div>
          {% endfor %}

          <div class="well">
            <button class="btn btn-large btn-primary" type="button" id="hp-login-btn">Log in</button>
            <button class="btn btn-large btn-success" type="button" id="hp-register-btn">New here? Register!</button>

            <div id="hp-login-form">
              {% from '_render.html' import render %}
              <form action="login" method="POST">
                <fieldset>
                  <legend>Log in to {{ config['HOTEL_NAME'] }}</legend>
                  {{ form.csrf_token }}
                  {{ render(form.login_username) }}
                  {{ render(form.login_password) }}
                  <button class="btn btn-large btn-primary" type="submit" id="hp-login-btn">Log in</button>
                  <span style="padding-left:15px">Don't have an account? <a href="#register" id="hp-loginreg-a">Register now!</a>
            </div>
          </div>

          <div id="ws-content">
            <div class="alert">TODO: Add filler content, maybe features?</div>
          </div>
{% endblock %}
I'll keep this thread update as I go along. Advice, feedback or suggestions are greatly appreciated!
 
This is what /me looks like so far. I'm not the best at designing, so this may change later. I'll add more links and things to the sidebar later on when I get to them.

Bui - [Python] CaveCMS - RaGEZONE Forums
 
Looks ok, but I don't like the character sitting in that corner.
Also.. dicks? Why not vagina's?

I'll probably move it somewhere fancy; not too sure where to place the user's look to be honest. I'll stick to something later.

Couldn't think of any better placeholder text, on /me I suppose there will be newsposts and whatever else I think of putting in the content area.
 
This is what /me looks like so far. I'm not the best at designing, so this may change later. I'll add more links and things to the sidebar later on when I get to them.

Bui - [Python] CaveCMS - RaGEZONE Forums
Not bad. You might want to make the button icons white too, though.
 
It would be nice to have a CMS that doesn't look like a ... :P
 
It would be nice to have a CMS that doesn't look like a ... :P

But it's not: sticky navbars are a feature of Bootstrap.

I might make the whole thing work with AJAX once you're in /me (eg. clicking news tab fetches and displays news), might be cool.
 
But it's not: sticky navbars are a feature of Bootstrap.

I might make the whole thing work with AJAX once you're in /me (eg. clicking news tab fetches and displays news), might be cool.
It's not that big of a deal, I'm just sick of bootstrap everywhere you go on the web. I understand, though, that some developers don't want to worry about UI design and bootstrap is an easy and attractive looking solution.

Python is a horrible language. Goodluck, however. Glad to see some variety in the community. :)
Python is a great language. Easy to learn, wide distribution, long history, good standard library, plenty of third party libraries for every job out there...

There's no excusing the whitespace but once you just get on with it and use a proper text editor with auto indentation you'll forget all about it.
 
Status
Not open for further replies.
Back