Django CMS edit gives no data - django

Django CMS = 3.1.1, 3.1.2, 3.1.3
Django = 1.6.5, 1.6.11
The problem is:
a user with proper access rights, who previously successfully edited a page, returns to a page, and attempts to edit it.
he logs in
he selects the page - in no-edit view, it loads fine, it has a collection of content
he goes to edit view - there is absolutely no page content - static content is there, but all content relevant to that particular page is missing.
Reverting versions does no good - any version is blank.
A user who is not stuck in this state can view and edit the page just fine.
When the problem occurs, it is stuck there for many repetitions.
Things that don't fix the problem:
server restarts
dumping and reloading the database
logging out logging in
upgrading django cms across the 3.1.X space
removing reversion
flushing the mysql cache
We have the same basic installation in vagrant dev boxes, a test server emulating all settings of the live (but with older data), and the live server - all three installations have seen this problem across 3 different variants of our other code bases.
Our data dumps from a MUCH smaller database taken from 9/13 do not have this problem
We haven't been able to find a trigger or a root cause.
The problem IS coming in intermittently, but over longish time spans. For example:
2 weeks ago, all privileged users could edit the page
4 days ago - several users experienced the problem. It was repeatable on more than 1/2 the pages of the site, but 2 pages worked fine for those users. Problem was repeatable for hours.
today - in the morning the problem persisted in the 4 day ago state.
6 hours later - the problem is gone on the live site, but persists elsewhere.
5 days later - it's back and it's affecting ALL users, including those who had not previously been affected.
I feel like I'm chasing a phantom here. Any help would be appreciated. I'm glad to give data dumps or anything else requested to see what can be done or if there's a best way to turn on debug logging to trace this.

Related

How to force ember.js to fully load all routes before it renders the index route?

I've recently created my first web app with ember.js. When I move between routes, they take too long to load which creates some ugly and not very app-like effects.
Unfortunately I am still very new to ember.js and therefore I'm unsure of which keywords to look and search for.
Feel free to check out this project at http://elephants.surge.sh/home.
Is there a method to load all routes, nested routes, templates, and components at once, while showing a loading template and before rending the index route?
After looking at your website, it's pretty clear that you've misdiagnosed the problem :) The laggy behaviors you are experiencing are not related to ember being slow to change routes...rather, your experiencing network lag. You can tell visually by seeing the text render instantly but your images taking forever to load.
Open up the network inspector of your browser of choice. Your vendor.js is 1.1MB and took 4.31 s for me to load. You have various images that took significant time to load (286KB in 2.47 s). So get a server that actually has decent bandwidth!
Besides better hardware, you're leaving a lot of optimizations on the table. You could minify your js and css in your ember-cli-build.js file:
module.exports = function(defaults) {
var app = new EmberApp(defaults, {
minifyJS: EmberApp.env() === 'production',
minifyCSS: EmberApp.env() === 'production'
});
};
Make sure your web server is also gzip compressing your files before serving them. This will improve performance.
Your images are also way overly sized. For instance, portrait.jpg on the home page is 1366 x 2048 px despite showing 370 x 500 img on my 15 inch mac book pro. Using a tool like ImageMagick, you could properly size these images for the web:
convert -resize 600 -quality 70 portrait.jpg convert.jpg
That's not even aggressive and drops the image from 157 KB to 51K. Drop the size / quality depending where your eyes draw the line.
Try using a tool like google page insights to further see places to improve.
PS. You need to make your http server fallback to index.html whenever it doesn't find a resource (since the route specific paths don't actually exist on the server). With apache that's just: FallbackResource /index.html. The link you sent doesn't work (only / does). Try refreshing on any of your routes and you'll see the problem
I've taken a look at your website and I would like to expand on what #mistahenry has said and hopefully it will result in some performance gains on your website 🎉
Firstly #mistahenry is right, it does seem that your site is not using the minified version of your app. By default, if you build your app for production it will minify your JavaScript and do a whole bunch of other optimisations. You will not need to edit your ember-cli-build.js file, but instead you will need to make sure that when you're building your app you pass the correct arguments:
ember build --env production
You can read a bit more about this command in the official Ember Guides. I am not familliar with how http://surge.sh/ works when it comes to deployment but if you could configure it to build your app in production mode that would be the way forward.
I would also recommend taking a look at Netlify for deployments because it also has a free hosting option and I know from experience that it by default builds your Ember apps correctly 🎉
Another thing that I noticed on your website is that when you go to http://elephants.surge.sh/home it shows up as a 404 (Not Found) error. You will see that if you go to http://elephants.surge.sh/ it works fine (and seems to redirect you correctly to /home) but then when you refresh it breaks again. This is not something that is specific to EmberJS, this is something that is common to all Single Page Applications and it just means that you need to specify the /index.html file as your custom 404 page so that the application boots correctly. If you do end up trying Netlify it has more information in their documentation about this specific type of issue. Unfortunately, I don't know how to solve this same issue on http://surge.sh/
Once you apply these changes you will find your app is loading significantly faster 🎉 but when it comes to performance there are always a few more things that you can do to improve things 😂
We actually ended up answering this question on "May I Ask a Question" Season 2 Episode 2 and went into a bit more detail about some of the other solutions that might help you. If you would like to see us discuss this answer in full you can check out the video here: https://youtu.be/9kMGMK9Ur4E and if you have any other questions you can always join the Ember Community Discord and reach out to me (#real_ate) and I will walk you through making your site lightning fast ⚡️
You can find more information about the Ember Community Discord on the Community Page of the Ember website

Blocked at google's two-step verification

So the story goes that I had a perfectly working script for the past week or so, it would log in to google (by loading a certain firefox profile - which allowed me to skip 2 -step verification), scrape some data from the company site (which needs google login to access), save to csv and quit. This would occur hourly for analysis.
Alas, alack, the issue arose this morning where instead of logging in directly, the two-step verification is appearing, even though the script has not changed at all. I cannot program to enter username+password, because it sends a text to my phone with a verification code after this...
I'm absolutely at a loss. I thought loading the firefox profile would avoid this problem (and it did for ~ 5 days). Can you help me?
I am using Python 2.7, Selenium & Mac OSX

Untouched CF Prod Code stopped working, related to redirects/Inserts/Updates

My production code worked fine for the last month and last week.
However, after our company main page was overhauled (BCM.EDU), my production CF forms stopped working, specifically for the following tags:
CFLOCATION, CFINSERT, CFUPDATE, Add/Change records using CFQUERY
When I click the buttons to perform the actions above, the page just stays the same and no updates/additions are done to the SQL database. Other stuff may have failed as well and not yet discovered. The code for these pages has NOT changed recently or over the past month.
I did not post any code because I did not think it was necessary. It's just generic textbook, basic CF.
It just stopped working overnight!
When the code was working I was told production uses CF9 and development uses CF7MX.
Now, only the DEV code works.
I have requested assistance and an explanation from the support group but they have yet to respond.
Has anyone encountered this situation?
Is this because of configuration changes, security or a new version of CF?

Coldfusion 8 scheduled task not running?

I started a job as a web developer at a company a few months ago managing a bunch of Coldfusion applications among other things. Apparently a scheduled task was set up many years ago, and worked fine until it stopped working under one of the previous web developers, a couple of years ago. No one knows why it stopped working, but it is now my job to fix it. This is my first job as a web developer, I didn't know CF when I started my job (barely knew it existed), and I only started learning about scheduled tasks this morning, so just know that I am a total newbie.
The file is a basic one- it just updates a table in the database. If you run the URL in the browser (which is what they have been doing for the past couple of years), it runs fine, and everything is updated. The scheduled task, which was set to run every night, has not been updating the file. I've tried turning on the log in CF Admin, setting it to run at various times this morning, and also just telling it to run manually, and according to the log, it is executing (with no errors), but the file is not being updated. I tried commenting out most of the file and just telling it to send a basic e-mail, with no variables or anything, but I am getting the same result.
Any ideas? I have no idea what to try from here. I tried looking for a solution online, but the only post I found similar to my situation is this, where people seem to be suggesting that the issue may be variables that are not available to the scheduler:
coldfusion scheduled task not sending emails
There are no variables on my page right now though. I tried running the task via CFSCHEDULE, per the suggestion on that page, but I got the same result as before. Some of the other suggestions (server monitor/FusionReactor/cflog) I just plain don't know how to do, so I have not tried those.
Edit: Right now, this is the only code in the page which is not commented out:
<cfmail
to="[e-mail address]"
from="[e-mail address]"
Subject="is it running at all?">
Is it running?
</cfmail>
Edit 2: Okay, now I've got something like this before and after the code for the e-mail:
<cflog
text = "before e-mail"
application = "yes"
log = "Scheduler"
type = "information">
I see the log messages if I actually go to the URL for the file (and the e-mail is sent as well), but not if I tell it to run the scheduled task from CF admin. Because the e-mail sends when I open the file in the browser, I don't think it is a problem with the mail server.
Edit 3: Yes, the e-mail addresses are plain, hard-coded strings.
I'm not exactly sure what you mean by "covered" by an Application.cfm file though. There is an Application.cfm file in the top-level of the site, but not within this particular sub-directory. There are a number of Application scope variables, but none that are used in the file as it is now.
Edit 4: Thank you for the explanation. As I said, total n00b when it comes to CF, so I appreciate the help. The Application.cfm page for this application checks to see if you are logged in, and if you are not, redirects you to the log in page. Could that be the issue?
Edit 5: YAY! It seems like that was the issue. Thank you thank you thank you! Leigh, please submit that as an answer so that I can choose it. You are my hero!
(From the comments )
A long shot but is your scheduled task inside a directory covered by an Application.cfm/Application.cfc file? The reason for asking is that the code inside the parent Application.cfm file executes first before your .cfm script. Is there any code inside the Application.cfm file that aborts a request or redirects (such as permissions check)?

postgres + GeoDajango - data doesn't seem to save

I have a small python script that pushes data to my django postgres db.
It imports the relevant model from a django project and uses the .save function to save the data to the db without issue.
Yesterday the system was running fine. I started and stopped both my django project and the python script many times over the course of the day, but never rebooted or powered off my computer, until the end of the day.
Today I have discovered that the data is no longer in the db!
This seems silly, as I probably forgotten to do something obvious, but I thought that when the save function is called from a model, the data is committed to the db.
So this answer is "where to start troubleshooting problems like this" since the question is quite vague and we don't have enough info to troubleshoot effectively.
If this ever happens again, the first thing to do is to turn on statement logging for PostgreSQL and look at the statements as they come in. This should show you begin and commit statements as well as the queries. It's virtually impossible to troubleshoot this sort of problem without access to the queries. Things to look for include missing COMMITs, and missing statements.
After that, the next thing to do is to look at the circumstances under which your computer rebooted. Is it possible it did so before an expected commit? Or did it lose power and not have the transaction log flushed to disk in time?
Those two should rule out just about all possible causes on the db side in a development environment. In a production environment for old versions of PostgreSQL you do want to verify that the system has autovacuum running properly and that you aren't getting warnings about xid wraparound. In newer versions this is not a problem because PostgreSQL will refuse to accept queries when approaching xid wraparound.