Closed GabeSoler closed 1 month ago
Hey, I have been trying Coltrane and I am having a nice site in my local machine. But when I am trying it in heroku is working super slow, a lot slower than my django app with database and all. I am new to this, so I may be missing something. It can be me :/
Coltrane is a static site generator, you are not suppose to run the coltrane play Command in prod, you build the static assets and upload them to a static file hosting platform like Netflix
https://coltrane.readthedocs.io/en/stable/cli/#record
Unless you are using it in integration mode in a classic django app
Hi, thank you for the response, but there is documentation for a heroku deployment, and there is whitenoise in it, so I thought it was going to be ok :/ I may do that in the end... but I like to have a dynamically generated site with only changing the markdown files... For some reason, when I tried to integrate it once, it did not work well for me. I feel I could do Django flatpages with a markdown extension instead, but I like Coltrane. I may be missing the point here, do you mean that it would be a lot easier to link a folder to a static site and then only render the record, and keep using record every time I need to update?
Hi, thank you for the response, but there is documentation for a heroku deployment, and there is whitenoise in it, so I thought it was going to be ok :/ I may do that in the end... but I like to have a dynamically generated site with only changing the markdown files... For some reason, when I tried to integrate it once, it did not work well for me. I feel I could do Django flatpages with a markdown extension instead, but I like Coltrane. I may be missing the point here, do you mean that it would be a lot easier to link a folder to a static site and then only render the record, and keep using record every time I need to update?
Oh my bad, haven't check the docs in a while, are you following this https://coltrane.readthedocs.io/en/stable/deployment/#heroku ?
Hey, thanks for your attention... yes, I am... Now I have been trying what you said, pressing record and linking it to a vercel repo. So, it is now static. It makes sense to reduce computing power but it has created new problems.
AttributeError: 'datetime.date' object has no attribute 'utcoffset'
I get this error message in the output, and for some reason some things are not working well, like an image does not render and some links are off (compared with local dev). I think it is small details these last things. Thanks for the advise! Still, it is great to have it on production... I think its a good idea, but its running badly :/ , I am only using the heroku eco, but I thought it would be enough.
Thanks for trying coltrane
out! I'm sorry you've been running into so many issues. :(
But when I am trying it in heroku is working super slow, a lot slower than my django app with database and all.
Well, that's definitely not expected. I have coltrane
as a builder for a static site, but I also run it with gunicorn
in the more dynamic fashion that it sounds like you would like. An example Dockerfile
that I am using is https://github.com/adamghill/unsuckjs.com/blob/main/Dockerfile, although it should be very similar to the Heroku Procfile in the docs. Have you tried removing nginx
from the equation? I wonder if it's interfering in some way?
Another thought is specifying a cache: https://coltrane.readthedocs.io/en/latest/env/#cache. I tend to have redis
running so I use that, but even setting it to memory
might do the trick.
AttributeError: 'datetime.date' object has no attribute 'utcoffset'
Hmm, utcoffset
is a method on datetime
, not date
so I think that's why the error is happening, but I'm not sure where in coltrane
that would be happening. Maybe is there a publish date that doesn't have a time on it? If that's the issue that seems like a bug that I can fix pretty quickly.
In general, if you can make a public repo that replicates the issue on Heroku I can take a look in more depth and see what the problem(s) might be.
Following-up after I did a quick test. I made publish_date
just a date:
And I get the error you mentioned:
I should be able to fix that pretty quickly!
@GabeSoler I have fixed that utcoffset
error in 0.36.0 which I just published to https://pypi.org/project/coltrane/. Let me know if that fixes one of your errors. 👍
Hi, thank you so much for getting into this. :) I did not expect such a fast response to fix the issue. It was what you thought. I had a publish date without the time. I noticed that with your fix, it says it happened at midnight, which is not a problem; it's just feedback. I made the repository public (just in case it helps on something). https://github.com/GabeSoler/coltrane_static_site.git
I am dropping the idea of using it in heroku. It is still brilliant to be able to host it to render dynamically, so this is just for feedback. I tried to erase the Gnix, but it crashed the site. I also tried erasing the build pack, and it crashed as well.
Re cache: I added
CACHE = 'memory', Regarding the settings, I thought it could have improved the speed. It still gets really slow in parts where it needs to read many of my MD files. I'm leaving this idea for now and rendering the static site that comes with the 'record' command as it is what I need. It is still really useful for what I have done, as any change I make can apply to all the files, and I feel really comfortable using Django style. I send the record to another folder that I then link to Vercel, so I push it, and it renders there for free. Many thanks for this cool app that I will definitely keep using. :)
I made the repository public (just in case it helps on something).
Thank you! I'm going to debug and see why it might be loading slow on Heroku.
I noticed that with your fix, it says it happened at midnight
Yeah, I wasn't quite sure what made the most sense. AFAIK RSS pubdate
requires a time, so I need to set it to something.
I'm going to close this for now, but will comment or re-open if it makes sense in the future.
@GabeSoler I think I know what was happening with your git repo.
Procfile
have web: python app.py collectstatic --noinput && bin/start-nginx gunicorn -c gunicorn.conf.py app:wsgi
heroku logs --tail
) and saw that the Django reload library was still being included in the site which looked to cause some request timeouts. This library should only be included on local development.DEBUG=0
environment variable to the Config Vars in Heroku>Settings.I'm not positive this was the issue for your site, but I am going to update the Coltrane documentation to make it more clear that DEBUG
should be turned off for production deployments.
I ended up added updates to the docs here: https://github.com/adamghill/coltrane/commit/87a0a5f752791175b61d7d0258bf07b5ea7a2337. Hopefully the changes sense!
Hi, thank you so much for this thorough analysis of what has happened. It makes me feel quite engaged in the app :) I have stopped trying, but I will look at it again (I started using the record command instead). I am quite certain I put something in the Heroku app (now deleted) for Debug, but maybe I did it wrong. It makes sense something was running in the background. The site in your dyno is moving as fast or many faster than the one I made static :) That is amazing! (I may come back to that option) It is excellent that you updated the documents!! I am quite a beginner here, and I get lost easily. :) I think Coltrane is great for when you are starting out and want to do more things with Django. Thanks so much. I really appreciate your presence here.
Hey, I have been trying Coltrane and I am having a nice site in my local machine. But when I am trying it in heroku is working super slow, a lot slower than my django app with database and all. I am new to this, so I may be missing something. It can be me :/