How to correct from getting Internal Server Error with Joomla - templates

Help
I am working on my joomla! 2.5.6 site and have done something to cause an issue on the front end and the back end.
These are the steps I did to create the issues.
Created a template in Artisteer 4 beta to use as a secondary template, not default.
I tried to delete the template but it told me that I could not delete the last template style.
I used FileZilla FTP to delete that template
The template manager still showed that template in the list.
I read that I had to use the ext manager to delete the template.
I uploaded the template back into a new directory as the same name as the one I previously deleted.
I then deleted the template correctly using the ext manager.
I decided to begin using rt-gantry v3.2.22 as my default template
Now, as I am making mods to this I am constantly met with a 500 Internal Server error. Most times just refreshing the page will take me to the page I wanted and sometimes it takes 2,3,4,5 refreshes to do it.
On the front end after I save a change and refresh the page, I may not see the change unless I refresh it several times. There are some instances that the page displays without any CSS, sometimes it displays with old data. Eventually it will display the saved changes correctly.
How can I find the source of this issue and correct it.
Thanks in advance,
Jeff
url is www.lastingimpressionwebdesign.com

Its a little confusing keeping track of what is or isn't there, but if you're able to get into the admin, then clearly it's a template issue. All the files, of course, need to be there, but there has to be an entry in the jos_extensions table to match them. Also, I'm suspicious of your comment that you're using rt-gantry v3.2.22 as your "template" - that is a framework for templates, not a template itself. You may want to update or re-install Gantry to insure you have a complete installation of it as well.
In short, I'd suggest reverting everything to a standard Joomla template such as Beez, *get the front-end working, and then start gradually adding back your choice in templates with overrides/assignments one step at a time.

It could be the ownership or permissions of your file. It could also be your hosting provider's server environment and how PHP is configured. It's hard to say without looking at the logs.

Related

django-compressor writing new files in collect_static/CACHE on every request

I've a django website set up using django-compressor + memcached.
Not sure when it started, but I'm finding new css and js files in .../collect_static/CACHE/css and .../collect_static/CACHE/js every minute, like output.2fde5b60eff0.css.
I use django.contrib.staticfiles.storage.ManifestStaticFilesStorage.
I have no clue if this is normal, or happening because of some misconfiguration. But in every few days, I need to clean the server because of this.
Any suggestions what is going on here?
Update: It seems to be happening because of template variables inside css and js code, as per this answer, but as I've a lot of such variables, I still don't know how to fix this.
Ok, so I found the underlying reason.
It is not actually the presence of template variables like {{context_data_var}} within compressed code.
It is the presence of any such variables the values of which change on each request.
I had two such instances:
Storage keys for the third party storage service (such as Google or Amazon)
csrf tokens used in various ajax requests
For 1. above, I simply moved such code outside compress.
For 2., the solution is slightly involved. I had to move away from using {{csrf_token}}. Django explains it in detail here. We need to use the csrftoken cookie instead of the variable {{csrf_token}}, and django sets this cookie if there is at least one {% csrf_token %} in the template. I had one luckily in my base template, so the cookie was already getting set for me. I also had the getCookie() function defined for all pages.
Thus, I was able to get rid of the issue explained in my question.

How could I modify django-tracking2 so users can opt out of tracking

I'm making a website right now and need to use django-tracking2 for analytics. Everything works but I would like to allow users to opt out and I haven't seen any options for that. I was thinking modifying the middleware portion may work but honestly, I don't know how to go about that yet since I haven't written middleware before.
I tried writing a script to check a cookie called no_track and if it wasn't set, I would set it to false for default tracking and if they reject, it sets no_track to True but I had no idea where to implement it (other than the middle ware, when I tried that the server told me to contact the administrator). I was thinking maybe I could use signals to prevent the user being tracked but then that would slow down the webpage since it would have to deal with preventing a new Visitor instance on each page (because it would likely keep making new instances since it would seem like a new user). Could I subclass the Visitor class and modify __init__ to do a check for the cookie and either let it save or don't.
Thanks for any answers, if I find a solution I'll edit the post or post and accept the answer just in case someone else needs this.
I made a function in my tools file (holds all functions used throughout the project to make my life easier) to get and set a session key. Inside the VisitorTrackingMiddleware I used the function _should_track() and placed a check that looks for the session key (after _should_track() checks that sessions is installed and before all other checks), with the check_session() function in my tools file, if it doesn't exist, the function creates it with the default of True (Track the user until they accept or reject) and returns an HttpResponse (left over from trying the cookie method).
When I used the cookie method, the firefox console said the cookie will expire so I just switched to sessions another reason is that django-tracking2 runs on it.
It seems to work very well and it didn't have a very large impact on load times, every time a request is made, that function runs and my debug tells me if it's tracking me or not and all the buttons work through AJAX. I want to run some tests to see if this does indeed work and if so, maybe I'll submit a pull request to django-tracking2 just in case someone else wants to use it.
A Big advantage to this is that you can allow users to change their minds if they want or you can reprompt at user sign up depending on if they accepted or not. with the way check_session() is set up, I can use it in template tags and class methods as well.

JSlink changes after creating site from template

I created a site with several lists and several CSR renderers for those lists. I applied the renderers to the forms via JSLink. Then I tried to save the site as template and create another one from this tempalte. All the JS links are now broken and lead nowhere.
Here is one of the JSLinks from the initial site:
<JSLink xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">~Site/SiteAssets/FormsManagement/Js/utils.js|~Site/SiteAssets/FormsManagement/Js/paymentsFormRenderer.js</JSLink>
</WebPart>
And here is what it changed to after the template creation:
<JSLink xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">/sites/home/test-subsite/SiteAssets/FormsManagement/Js/utils.js|/sites/home/test-subsite/SiteAssets/FormsManagement/Js/paymentsFormRenderer.js</JSLink>
These changes break all my CSR and I have no idea how to fix it. I am aware that these two links have to be equivalent, although on the recreated subsite, browser tries to load the javascript from a domain of cdn.sharepointonline.com which is wrong. (I suspect this is due to wrong relative addressing).
All the help is much appreciated! Thanks in advance.
So I figured it out. I am not sure what the problem was but I found the workaround that seems to work pretty good.
I scraped entirely the idea to use JSLink and instead I used <SharePoint:ScriptLink> tag and included the scripts that way. I wrapped my scripts so that they use ExecuteOrDelayUntilScriptLoaded([Script's closure here], 'clientForms.js');
This seems to yield the same result as using JSLink, but the tokens in JSLink are not expanded to relative urls and links are not broken. The only downside is that no one is able to modify the scripts without the Sharepoint Designer as they are no more listed in JSLink field.

TFS 2010 process template work item customisations

I've created a new default Process Template called "My Agile V2" and uploaded it successfully into our TFS repository.
I also have some exported work item definition files, i.e. Bug.xml and UserStory.xml which have some customisations made to them i.e. adding a few additional fields and the like. We already successfully use these customised work items on some of our existing projects..
But I'd now like to include these customised work items in as part of the new "My Agile V2" Process Template so that every time we create a new project, we don't have to import these same bug.xml and userstory.xml files every single time.
I managed to export "Download" an existing Process Template, overwrite its bug.xml and userstory.xml files in the "WorkItem Tracking > TypeDefinitions" folder and then re-upload it. The Upload worked, however the work item customisations didn't come through whatsoever. I.e. they still have default behaviour and none of my custom fields...
Where am I going wrong???
Thx a lot
I think just importing WITs is not enough. Have a look at the page for Adding a Work Item Instance to a Process Template

Are Django template tags cached?

I have gone through the (painful) process of writing a custom template tag for use in Django. It is registered as an inclusion_tag so that it renders a template. However, this tag breaks as soon as I try to change something.
I've tried changing the number of parameters and correspondingly changing the parameters when it's called. It's clear the new tag code isn't being loaded, because an error is thrown stating that there is a mismatch in the number of parameters, and it's evident that it's attempting to call the old function.
The same problem occurs if I try to change the name of the template being rendered and correspondingly change the name of the template on disk. It continues to try to call the old template. I've tried clearing old .pyc files with no luck.
Overall, the system is acting as though it's caching the template tags, likely due to the register command. I have dug through endless threads trying to find out if this is so, but all could find it James Bennett stating here that register doesn't do anything. Please help!
I have gone through the (painful) process of writing a custom template tag for use in Django
I agree that the process for writing the template tag in django is more elaborate than it needs to be.
But let me point you towards some of the third party apps, that when installed, a template tag is just another python function (or class).
http://github.com/alex/django-templatetag-sugar
http://github.com/codysoyland/django-template-repl
Firstly, I can't imagine what's complicated about inclusion tags. Writing a completely custom tag from scratch, yes: that's complicated. But inclusion tags are simply three lines of code and a template - what's complicated about that?
Secondly, all Python code in your Django project is loaded once by the server [*], and remains until it is restarted. The dev server usually detects changes and restarts itself to reload the code, but this doesn't always work. You should get into the habit of checking the console to see that it does restart, and doing it manually if necessary. Note that this has nothing whatsoever to do with caching.
[*] strictly speaking, once per process, but the dev server is single-process anyway.
In case anybody else encounters this: the exact caching mechanism is unclear, but restarting the django dev server fixes the problem.