my_site | My personal website , simple blog , in python using Flask | Static Site Generator library
kandi X-RAY | my_site Summary
kandi X-RAY | my_site Summary
My homepage, a simple blog and stuffs, using Python(flask).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of my_site
my_site Key Features
my_site Examples and Code Snippets
Community Discussions
Trending Discussions on my_site
QUESTION
I'm setting up a deploy-on-git-push process on a remote Debian server. It is basically the common approach of having a bare repository with a post-receive hook which does a checkout to the web server's docroot, more or less.
I've used slightly simpler variations of this set up successfully for years, but this time around I'm complicating it by trying to separate ownership of the git repo and the site files between 2 different users. I don't want the user who can SSH in (the git push happens over SSH) to have write perms to the site, and vice-versa (the site user shouldn't have write perms to the git repository).
I have 1 user, let's call her
git-user
, who owns a bare git repository at/var/gitrepos/my_site.git
, and this user is the only user allowed to connect over SSH;I have a 2nd user, say
site-user
, who should own the checked-out files at/var/www/site
;
I push over SSH to the repo, and this means any post-receive hook runs as the user I SSH in as - git-user
in this case. So the post-receive hook can't do the checkout itself, as the site files would end up being owned by git-user
, not site-user
.
So my post-receive simply touches a trigger file, /var/run/deploy
. A separate script is run from site-user
's cron frequently, eg every minute, looking for that file. If it sees it, it does a checkout to /var/www/site
. The relevant part of that script looks something like:
ANSWER
Answered 2021-May-16 at 14:07Another option would be for the git-user
to create an archive that contains all the relevant files to be deployed (think of it as an artefact). This can be done in the post-receive hook before touching the trigger file. To create the ZIP/TAR, you can use the git archive
command which facilitates this step.
As soon as the cron-job runs and a deploy is triggered, the site-user
extracts the contents of the archive into /var/www/site
and removes the archive.
This way, the git-user
has no access to the webroot. At the same time, the site-user
does not even need read-access to the repository.
It is also possible to specify an alternative index-file with the environment variable GIT_INDEX_FILE
to circumvent the default location ($GIT_DIR/index
). But I don't know if Git needs write access to other files/folders as well.
QUESTION
I figured out how to set Local Group Policy for my own local testing...via gpedit...
Local Computer Policy --> Administrative Templates --> Microsoft Edge
- Configure Internet Explorer Integration
Click Enabled
Under Options - select Internet Explorer mode
- Configure the Enterprise Mode Site List
Click Enabled
Under Options - enter file:////c:/my_sites/sites.xml
- This is from c:/my_sites/sites.xml
site url - "www.google.com"
compat-mode - default
open-in -IE11
site url - "internal001.here.com"
compat-mode - default
open-in - IE11
However, I've been trying all day and nothing seems to take. Edge just opens google and that internal001 site in Edge. Do you guys have any ideas what could be blocking or missing? Thank you.
...ANSWER
Answered 2021-Mar-23 at 16:33I downloaded the Enterprise Site Manager v2 and created the XML through the tool and it works, for whatever reason. Before I copied and pasted into notepad and plugged in my sites. I am going to mess with this, maybe try the manual XML again with the info from v2, see if that takes. i am also going to run the clear cache as I need to add and remove sites while I test.
QUESTION
I wanted to deploy my Django website on port number 8000 in my AWS ec2 instance of the ubuntu machine. But after running the Nginx server, I'm getting the following 400/Bad request error in the browser, and in the Nginx error log, it's showing as follows.
...ANSWER
Answered 2021-Mar-16 at 06:14Finally I got the answer from a facebook group. Thanks Hassan Aly Selim. Since, my Nginx server and my Django website are running on the same machine, server_name should be localhost (Nginx will access website within the same network). For more understandability, I'm putting the modified configuration below. my_site.conf
QUESTION
I added Vue to my Django project, but since i didn't want to decouple frontend from backend, i decided to load webpack directly from Django. My setup seems to work with django webpack loader, but i'm having some doubts on how i structured the project.
Here is my folder:
...ANSWER
Answered 2021-Mar-15 at 17:09My doubt is: should routing be handled by Django or should it be handled by Vue in a SPA?
Your FE needs to know the routes if you're going to do SPA, e.g. your FE needs to know how to update the URL if user clicks on a link/item. Otherwise there would be page refreshes or wrong URLs.
So here i'm not using Vue to handle routes, but i load individual Vue components of the same app in those Django templates where i need them. My doubt: is it a bad practice? Are there reasons for which i should avoid doing so?
I think you need to decide it you're going to build a SPA or not. My rule-of-thumb is SPA is better if have a lot of interactions on your page or you have a team of speciallized people for FE. Having a total separation between BE/FE is definitely industry de-facto standard but rendering most stuff on BE and having a lightweight FE is not a crime either, Stack overflow itself uses such approach.
If you're going with SPA, putting FE URLs in BE also makes not much sense (unless you're doing something like server side rendering). BE will provide a set of API URLs (invisible to end user) and FE will consume them and provide a set of FE URLs that users would see.
Yes, the main problem is that having the apps hosted on two different domains might make me lose a lot of django benefits in terms of security. I have some doubts on storing a jwt token on local storage, i don't think its the safest solution; there is session based auth but i don't know how would it work on two different domains. Another thing is the lack of examples on this, and finally the biggest problem is that i already setup the app on this environment, so moving to decoupled would be quite a pivot
There are multiple answers for your concern.
1- There's no need to have separated domain. You can prefix all your BE URLs with /api/
then on production you can use a reverse-proxy like NGINX or Traefik or your load balancer, ... to separate the two. Having separate domains is easier to maintain in long run but you'll need to handle cookie/CORS issues now and then.
2- If you have separated domains you can set cookies on the main domain from subdomain with this settings
3- There's no need to go with JWT token in localstorage. IMO it's inferior to having httponly cookies. Django session auth has httponly turned on by default. This way random npm libraries you installed or 3rd party scripts on your page has no way to access and steal the token.
4- On a separate note, Django CSRF protection is kinda obsolete now we have samesite cookie on browsers. Check browser support here. Newer versions of Django defaults to Lax that protects you from CSRF on supported browsers. So you can turn that protection off to have one less headache.
I personally think you can stick to Django session based auth, no need to add anything to your FE. FE will just call /api/auth/login
and proper cookies will be set automatically.
To be more robust you can add an API like /api/auth/me
that returns current logged in user data to FE. FE will call that when user visits your website for first time to understand if user is logged in or not.
QUESTION
I have a website running an OctoberCMS theme that I built. It's running on a server from DigitalOcean. I need to add a separate project (namely code from Matomo analytics) on the same server and access a public page (e.g. my_site.com/matomo). I'm new enough to Laravel and server configurations that I'm unsure of how I need to configure the index.php files or maybe something like .htaccess so that I can access my_site.com/matomo.
Here's my file structure
...ANSWER
Answered 2021-Jan-26 at 05:57You don't need to fix anything in index.php. Analytics counters can be added to the layout (~/themes/mytheme/layout/mylayout.htm) of the page between the
QUESTION
I have 2 apps in my project, "landing" and "news". Right now, I have the URLs configured like this:
project/urls.py:
...ANSWER
Answered 2020-Dec-06 at 04:05You should specify different namespaces, and app_name=…
is not a valid parameter for include(…)
. You in fact do not need a namespace in the first place, you can in both urls.py
specify an app_name
:
QUESTION
I want to add link tags to the head so I can preload some font files in my site package.
I have tried using headerData
but how can I get file path to EXT:my_site/Resources
?
ANSWER
Answered 2020-Nov-30 at 08:52For any field in TypoScript that uses the getText
data type, you can use path:
for that. For example:
QUESTION
I am working on creating a puppet module. My puppet version is 3.8.7 and upgrade is out of the question. My hieradata and relative contents of init.pp file is copied below for reference.
...ANSWER
Answered 2020-Nov-24 at 10:03The main issue is that you are using the literal string (single quotes) as the title to your file object instead of an interpolated string (double quotes). update your file object to the following an i think it should work
QUESTION
I have an HTML page with multiple collapsible buttons. I'd like one button to be expanded when the page is loaded. Right now all buttons are collapsed by default. How do I change the HTML or CSS so that a particular button (Current Week) is expanded and the rest are collapsed? Here's the relevant code:
...ANSWER
Answered 2020-Nov-10 at 16:16Maybe I didn't understand something but why don't you just run the code ran in your eventlistener's function in the main thread?
In the event where you work with dates later on, you could make a separate function for it, like so:
QUESTION
I have a site build in site123
(site123
is a WYSIWYG and it dose not support code export). I use it as a nice designed landing page and product's catalog. so I have:
https://app.site123.com/?w=my_site
this site has no back-end (not supported by site123
). and I have another site build in django
for payments and other stuff like this I host it on pythonanywhere
, So I also have http://my_website_with_backed.pythonanywhere.com/
.
Now, I buy a domain from GoDaddy
and I would like to know if there is a way to connect the 2 websites under the same url??. like:
site123 website
: www.catalog.my_own_url.com
django website
: www.payment.my_own_url.com
Thank you
ANSWER
Answered 2020-Aug-29 at 15:23You can do a redirect from the subdomains to your page but in this case you will have the 3rd party URL displayed and not your subdomain.
You can probably use a simple HTML structure with iFrames to include your page. Like connecting your subdomains with a server and hosting there a HTML page which loads your python or WYSIWYG page.
If site123 is a static landing page without many changes or dynamic elements, I would think about scrapping it with a script and transfer it to a server which also supports python (e.g. Amazon AWS). In this case you can get rid of pythonanymwhere and use your subdomains. Then you can either use site123 (and scrape it every night for example) or use another WYSIWYG editor to build a page and deploy it to your server.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install my_site
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page