39 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
8dcafe3e0e
middleware: New middleware to check need for setup
- Call the setup helper to check if a installation or update of a module
  is required.

- Show installation and progress using the setup view.
2016-02-13 13:50:16 +05:30
Sunil Mohan Adapa
7f4c5f7410
Make app names as module identifiers
- The last part of the module import path is the module name.  This also
  becomes the Django app name.  Apps names have to be unique.  Hence,
  there is no scope for two different modules with same name but
  different load path to exist in the project.

- Most uses of list of loaded modules are dealing with app names instead
  of full module load path.  This is due to the fact that Django deals
  with app names and not module paths.

- It is also somewhat clumsy to access a loaded module as we are
  re-importing every time to get access module.

- Simplify all of the above by using app names are module identifiers
  and maintaing an ordered dictionary of app names to loadded modules.

- Remove unused imports.

- Minor styling fixes.
2016-02-13 13:49:23 +05:30
Sunil Mohan Adapa
a1d5486c82 config: Refactor for easy testing
- Split the read method into two separate methods for getting the config
  file and for reading config file.

- Use logging module for printing error.

- Fix global variable naming.

- Get/set/show the realpath of the config file.

- Convert config items into a list so that the order is more
  predictable.  This is the reason for unpredictable failures in test
  cases.
2015-12-05 09:51:50 -05:00
Sunil Mohan Adapa
db548a4e24 Make migration work for older version upgrades
With the --fake-initial argument to migrate, Django will detect the
existance of initial table with the precondition that the table schema
must be the same as the first migration (it is in this case).

https://docs.djangoproject.com/en/1.8/topics/migrations/#adding-migrations-to-apps
2015-12-05 09:33:23 -05:00
Sunil Mohan Adapa
e6117fbcdf Update TEMPLATES setting for Django 1.8+ 2015-12-05 09:33:23 -05:00
Sunil Mohan Adapa
a432e16ed7 Use migrate management command instead of syncdb
- syncdb has been deprecated in Django 1.7 in favor of migrate command.

- In Django 1.9 it has been removed.  Django 1.9 has already hit Debian
  unstable.
2015-12-05 09:33:23 -05:00
fonfon
aeaa6ab800 Adds a 'language' dropdown field to the system configuration
- The language choice is stored with the session, not persistently
- This removes confirmation messages if nothing was changed
2015-11-18 18:29:54 +01:00
Sunil Mohan Adapa
139db064a9 Enable localized numbers and dates 2015-11-13 21:18:37 +05:30
Sunil Mohan Adapa
6c3c863619 Enable switching locale on a per-request basis 2015-11-13 21:18:04 +05:30
Sunil Mohan Adapa
45fd4f2a53 Cleanup casting from values in cfg 2015-09-29 22:50:02 +05:30
Sunil Mohan Adapa
38fe07cd93 help: Serve FreedomBox manual
- Remove FAQ menu entry

- Remove Wiki entry and place a link from index page.

- Update index content to point to IRC, wiki, manual and mailing list.
2015-09-27 09:49:45 -04:00
Sunil Mohan Adapa
0febeb7244 diagnostics: Add --diagnose command line option
- When this option is provided, Plinth will initialize, load modules,
  execute diagnostics, print the results on console and quit.

- Replacement for /usr/lib/freedombox/testsuite
2015-08-29 06:22:01 -04:00
Sunil Mohan Adapa
2b1b60fba5 Minor coding styling update in main.py 2015-08-29 06:22:01 -04:00
Sunil Mohan Adapa
6fd04808d5 Don't require login for logout page & minor fixes 2015-07-01 07:57:21 +05:30
fonfon
824a9091c1 use django-stronghold for authentication handling (instead of @login_required) 2015-07-01 00:01:02 +05:30
Maximiliano Curia
8418713741 Remove unneeded extra server 2015-06-08 21:44:55 +02:00
Maximiliano Curia
24fe6131fc Use the cherrypy autoreload feature only in debug mode
Small devices like the raspberry pi end up eating a number of resources (~20%
of the CPU according to top, even more if something else is increasing the
load, together with tor they eat ~70% of the cpu "on idle" ~50% for plinth
and ~20% for tor) stat the files once per second.
2015-06-08 13:13:29 +02:00
Sunil Mohan Adapa
e09018fe9a Fix issues with configuration/parameters loading
- Change default server directory from plinth/ to /plinth as the program
  expects.

- First load the values from configuration file and then override them
  with command line parameters.

- Show default values on the command line help.

- Use configuration file values as default values to command line
  parameters.

- Log the value of script prefix (server_dir) for easy debugging.

- Make sure the server_dir is properly loaded from configuration files.
2015-04-07 22:43:25 +05:30
Sunil Mohan Adapa
3fcbb36a21 Serve /usr/share/javscript on /javascript
Since the links to javascript libraries have been removed in favor of
using javscript-common, it is no longer possible to run Plinth stand
alone without a reverse proxy that also serves /javscript.  This patch
fixes that.  Now /javascirpt is also available when Plinth is running
stand alone.
2015-01-25 01:50:31 +05:30
Sunil Mohan Adapa
baa9205852 Fix issue with styling of error messages with bootstrap3 2015-01-25 01:17:58 +05:30
Sunil Mohan Adapa
90203986f2 Remove modules 'expert_mode' and 'lib'.
The login/logout URLs are now in the 'users' module.
2014-12-14 17:26:05 +05:30
fonfon
96a14e3d0d moved 'in-app menu' from the sidebar to the top of the content; some template block renaming 2014-12-06 17:08:37 +05:30
Sunil Mohan Adapa
1b6969a8a6 Rethink how proxied headers are handled
- Request Apache to send X-Forwarded-Proto header.

- Use X-Forwarded-Proto header to understand original protocol
  requested.

- Use X-Forwarded-Host header to understand original host requested.

- Allow any incoming host header so that FreedomBox can have any
  hostname and when user requests for Plint with that hostname, it
  works.

- Don't depend on Apache to rewrite the Location: header.  Instead use
  the original host and original scheme to set proper Location: header.
2014-11-30 15:11:50 +05:30
Sunil Mohan Adapa
fcc1330318 Relicense __main__.py to AGPLv3+
- There is no point in keeping this one single file as with different
  license from the rest of the package.  This change simplifies things.

- The file has been almost entirely been rewritten for Django, module
  loading, CherryPy static directories etc.

- This change will be pushed with the consent of new authors: fonfon and
  Me.
2014-11-30 14:49:49 +05:30
Sunil Mohan Adapa
4637bba3eb Print debug message about static directories served 2014-10-20 00:22:33 +05:30
fonfon
699a3ac0dc fixed static_dir of modules; omit hidden files in modules_enabled directory 2014-10-20 00:14:09 +05:30
Sunil Mohan Adapa
fc2fdc4d27 Turn modules into proper Django applications 2014-10-04 13:43:22 +05:30
Sunil Mohan Adapa
cc549fff61 Load modules using explict paths instead of config file name 2014-10-04 13:41:27 +05:30
fonfon
ea982bf73e call django.setup before syncdb for django 1.7 compatibility 2014-10-01 19:18:27 +02:00
Sunil Mohan Adapa
770e4c00fd Merge remote-tracking branch 'fonfon/dev' 2014-09-11 19:16:13 +05:30
Sunil Mohan Adapa
42d05bfe1f Use Django models to store variables
- Remove dependency on withsqlite and use Django models.
  This avoids depending on a module that is not available in PyPi.
  Withsqlite does not have Python3 support. It does not work when
  we choose a different database backend. Atleast partly duplicates
  what Django models are meant for.

- Check and update database schema on every run so that
  newly added modules can add tables and old ones can update.
2014-09-10 12:35:35 +05:30
fonfon
d661b64a33 fixed static dir of plinth-modules 2014-09-09 16:20:35 +02:00
Sunil Mohan Adapa
7a649b6f81 Remove duplicate, outdated version info from __main__.py 2014-09-02 18:26:43 +05:30
Sunil Mohan Adapa
27cdadbc76 Log a message showing the config file used 2014-09-02 14:47:35 +05:30
Sunil Mohan Adapa
f243dfa3ab Allow running from working directory 2014-08-31 16:32:11 +05:30
Sunil Mohan Adapa
6d3170ece4 Use os.path.join() for creating a static directory path 2014-08-31 13:18:09 +05:30
Sunil Mohan Adapa
f4edfdedc6 Fix first boot middleware for new module structure 2014-08-31 13:17:37 +05:30
Sunil Mohan Adapa
85f02c744e Remove vendor directory infavor of python module dependencies 2014-08-30 09:41:47 +05:30
Sunil Mohan Adapa
65fa648d9f Reorganize python sources into 'plinth' package 2014-08-29 12:57:27 +05:30