Giter VIP home page Giter VIP logo

django-mako-plus's People

Contributors

asmockler avatar doconix avatar jofinh avatar knowsuchagency avatar kyleamathews avatar lucaspcarvalho avatar ngoue 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

Watchers

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

django-mako-plus's Issues

User Set Database Variables

This isn't an issue for DMP but maybe Django itself (or my inability in this area). What is the recommended practice for storing settings that would be set by the user but would apply to the entire app? For example, lets say an app I'm running should be displayed in a particular theme, a set time zone, or default values that would populate fields within the app. My original thought was to create a 'settings' model but that seems counterintuitive since the database won't ever have more than the one value that will be set on the settings page. The other idea, which I've used for other programming languages, is to create a settings.cfg file of some sort on the system and parse the file. But again, this seems a little clunky to me on DMP. What do you suggest @doconix?

"dmp_startapp" changed to just "startapp"

This part of the installation guide mentions to use

python3 manage.py dmp_startapp homepage

But should it be this?

python3 manage.py startapp homepage

I get this error:

C:\Users\spiva\Desktop\IS 413 Final\Test>python manage.py dmp_startapp homepage
Unknown command: 'dmp_startapp'
Type 'manage.py help' for usage.

Make `dmp_render()` take `content_type` and `status` args like Django `render()`

The Django render function allows the following args:

render(request, template_name, context=None, content_type=None, status=None, using=None)

Two very useful args are content_type and status which allow the caller to better tune the properties of the HttpResponse object that DMP will return.

Without this feature, the caller needs to do something like the following to set these values:

html = dmp_render_to_string(request, 'template.html', params)
return HttpResponse(html, status=201, content_type='text/html')

Werkzeug debugger broken

When I use django-mako-plus, I lost the Werkzeug debugger functionality (using runserver_plus). It seems that DMP is outputting the page without passing it to Werkzeug. Is there some setting that I've missed?

How to pass the mako variable or python variable to a js function ?

I am looking the source code of the hue and what to do some change.I noticed that in the .mako file ,It contains javascript and out side of the js we can use the mako syntax and get the variable in the context,but I want to use it in the js function.I don't know how to get it,I think it can be geted,so i asked the way.

Templating System doesn't play nice with projects like social-auth-app-django

social-auth-app-django is a project that is commonly used to simplify social authentication with sites like Twitter and Facebook. Using the system they currently have, authentication is handled by sending users to a url such as <a href="{% url 'social:begin' 'facebook' %}">Sign up</a>.

DMP converts the templating language so this isn't recognized. Looking at this page of the documentation, it looks like we should be able to get around this by changing the above code to <a href="<% url 'social:begin' 'facebook' %>.

One possible solution I'm looking into is using regex to ignore certain urls from loading with the DMP engine:

urls.py:

urlpatterns = [
    # the built-in Django administrator
    url(r'^admin/', admin.site.urls),

    # urls for any third-party apps go here
    url('oauth/', include('social_django.urls', namespace='social')),

    # the DMP router - this should normally be the last URL listed
    re_path(r'^(?!(oauth.*)$).+$', include('django_mako_plus.urls')), <-- This is modified
]

The problem with this is that it changes the number of view arguments called which causes the page to display an error.

Is there another way around this?

Django 4.x Support

I understand this project is in the deep freezer, but I do have a few clients who are still using this project. With that in mind, I have a PR with experimental django 4.1 support .

#58

It is also worth noting that django 3.2 will lose support this year, which appears to be the most recent version this project currently supports.

"ImportError: cannot import name 'get_renderer'" in tutorial

The line in the readme tutorial in the file homepage/views/index.py gives me an error:
ImportError: cannot import name 'get_renderer'

By changing it to
from django_mako_plus.controller import view_function, router

and then changing
templater = get_renderer('homepage')
to
templater = router.get_renderer('homepage')

the error goes away and everything works fine.

Issues with dmp not finding *.jsm file

I'm working on a project demonstrating dmp running on docker, and as I've gone through the tutorial to re-familiarize myself with the framework, I've encountered an issue where dmp doesn't seem to include the expected jsm file.

To replicate, one can clone this project and launch the site with docker-compose up web which will run the site on localhost:8000.

If index.jsm is renamed to index.js, the homepage app works fine. Otherwise, it doesn't seem to be included in the page's source.

Unable to use Django Syntax Blocks within a Mako template

I am trying to use Django syntax in my Mako template. I've followed the directions in the documentation, but it throws an error.

<%block filter="django_syntax(local)">
        {% load compress %}
</%block>

I get TypeError: 'Undefined' object is not callable for the following line <%block filter="django_syntax(local)">

Any suggestions on how to go about fixing this?

Django in a subdirectory

I have install my django app in a subdirectory like:

my.domain.com/devSite

and when I hit my application running in:

my.domain.com/devSite/timesheets/index

I see that django-mako-plus is interpreting the path incorrectly. I get:

[Mon Mar 16 16:05:08.744563 2015] [:error] [pid 31279:tid 140465995564800] DEBUG DMP :: processing: app=homepage, page=devSite, func=process_request, urlparams=[u'timesheets', u'index']                                                                                                                                   
[Mon Mar 16 16:05:08.748229 2015] [:error] [pid 31279:tid 140465995564800] DEBUG DMP :: module homepage.views.devSite not found; sending processing directly to template devSite.html                                                                                                                                       
[Mon Mar 16 16:05:08.748460 2015] [:error] [pid 31279:tid 140465995564800] DEBUG DMP :: App homepage is not a designated DMP app.  Template rendering is not possible without DJANGO_MAKO_PLUS=True in its __init__.py file.                                                                                                

while I was expecting to read something like:

processing: app=timesheets, page=index, func=process_request, urlparams=[]   

How can I inform django-mako-plus to start reading after my subdirectory...?

[edit]: Just to clarify, that the app in the local development server is working fine. Only during my production install (through WSGI) I get that error, when I try to run it from a subdirectory.

Thanks!

dmp_collectstatic creates empty static folder

Hey,

First I just want to say that I've been using this framework for over 2 years and I absolutely love it. Recently I came across an issue with dmp_collectstatic. After running python manage.py dmp_collectstatic it creates an empty static folder(without any of the css, js, html or any other folders). Not sure exactly what is causing this issue. Just thought I'd bring it to your attention.

Thanks again for making such a spectacular package for Django.

Django @csrf_exempt doesn't work

The way routing works with DMP prevents Django's @csrf_exempt (and probably a myriad of other decorators) from functioning correctly. DMP doesn't actually give the decorated view function back to the CsrfViewMiddleware – instead it's getting the DMP route_request function and so it never gets the @csrf_exempt check to pass.

dmp_startapp breaks with django v 1.10

DMP requirements state that django 1.8+ are compatible, but after upgrading to 1.10 I get the following error message when I try to start a new DMP app.

(Input) $ python manage.py dmp_startapp homepage
(Output) WARNING Sass integration not enabled.
usage: manage.py dmp_startapp [-h] [--version] [-v {0,1,2,3}]
[--settings SETTINGS] [--pythonpath PYTHONPATH]
[--traceback] [--no-color]
manage.py dmp_startapp: error: unrecognized arguments: homepage

"apps aren't loaded yet" exception on clean install, using installation instruction from docs.

Following the docs installation instructions exactly raises an "Apps aren't loaded yet" exception. full error message:
`(venv) macs-MBP:BYU webdev mac$ python3 -m django_mako_plus dmp startproject goldenspikes
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_mai
n
"main", mod_spec)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/site-packages/django_mako_plus/main.py", line 51, in
main()
File "/usr/local/lib/python3.6/site-packages/django_mako_plus/main.py", line 46, in main

management.execute_from_command_line()

File "/usr/local/lib/python3.6/site-packages/django/core/management/init.py", line 371, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/site-packages/django/core/management/init.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 280, in run_from_argv
parser = self.create_parser(argv[0], argv[1])
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 254, in create_parser
self.add_arguments(parser)
File "/usr/local/lib/python3.6/site-packages/django_mako_plus/management/commands/dmp.py", line 56, in add_arguments
for name in find_subcommands():
File "/usr/local/lib/python3.6/site-packages/django_mako_plus/management/commands/dmp.py", line 80, in find_subcommands
dmp = apps.get_app_config('django_mako_plus')
File "/usr/local/lib/python3.6/site-packages/django/apps/registry.py", line 145, in get_app_config
self.check_apps_ready()
File "/usr/local/lib/python3.6/site-packages/django/apps/registry.py", line 127, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.`

Is this an issue with the initial dmp template? you can install without dmp in the startproject command, but then cannot use dmp in startapp command

This was an issue on macOS and ubuntu

Django 1.8.3 support

Is Django 1.8 supported by this app. I'm trying to use the contrib messages app but no messages are appearing on pages. This appears to be because, although they are stored in a cookie, the context processors never get run to provide them as local variables. Is there some voodoo needed because of the changes to the Django template backend?

Is there a way to use DMP without the dmp router?

This package is amazing but I was wondering if there was a way to use it without following dmp routing and view conventions.

I have a django app already, and I would simply like to replace the syntax of my current django templates with what dmp provides with mako. Is there a straightforward way of doing so?

Django 2.0 - ImportError: cannot import name 'RegexURLPattern'

Started a project using the new DMP (comes with Django 2.0) as shown in the tutorial but got import errors from the urls.py:

Server Debug Statements:
File "C:\tmp\dmp_test\lib\site-packages\django_mako_plus\urls.py", line 5, in from django.urls.resolvers import RegexURLPattern # Django 1.10+
ImportError: cannot import name 'RegexURLPattern'

File "C:\tmp\dmp_test\lib\site-packages\django_mako_plus\urls.py", line 8, in from django.core.urlresolvers import RegexURLPattern # Django 1.9
ImportError: No module named 'django.core.urlresolvers'

--

When I drop to Django 1.10.5 everything works except I can't get the JavaScript files to load. The slashes for the .js files are missing:

Console Error in Chrome v.63:
GET http://localhost:8000/static/homepagescriptsindex.js?1513746160 net::ERR_ABORTED

Page Head:

<script> DMP_CONTEXT.set("4.4.8", "u5a39f5b2cb096002923ada07000840", {}); DMP_CONTEXT.linkContextByName("u5a39f5b2cb096002923ada07000840", "homepage/base");</script> <script> DMP_CONTEXT.addScript("u5a39f5b2cb0c6002923ada07000840", "u5a39f5b2cb096002923ada07000840", "homepage/index", "/static/homepage\scripts\index.js?1513746160", false);</script> <script id="u5a39f5b2cb0c6002923ada07000840" data-template="homepage/index" data-context="u5a39f5b2cb096002923ada07000840" src="/static/homepagescriptsindex.js?1513746160"></script> <script>DMP_CONTEXT.linkContextByName("u5a39f5b2cb096002923ada07000840", "homepage/index");</script>

login_required decorator no longer working

In the latest version of dmp the django.contrib.auth.decorators.login_required decorator no longer works. When added to a view, the code is ignored and doesn't raise any errors. Anonymous Users are still able to access the page.

In addition to this, if accessing User information, the page fails to raise an error if the information does not exist. As an example, when trying to display the username with ${request.user.username}, nothing shows up. The page loads as normal, but without any necessary information.

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.