Currently the way Docker is set is that Django serves static files i.e. style-sheets etc which takes care of the design of my web app.
When I turn DEBUG Mode off, Django lets the actual server serve static files, for performance --- but currently docker (hosted on Render.com) is not configured to do that --- therefore the website is haywired and the design is all wacked out.
Sorry, I'm a noob. Any advice would be appreciated.
The WhiteNoise library can help you with this! Check out the WhiteNoise docs or https://render.com/docs/deploy-django#static-files.
On Render, the internet-facing web server is provided by default and we need a way to host static files using it. In this step, we will set up WhiteNoise which is a highly popular solution for this problem. The following instructions are a short overview of the procedure described in the WhiteNoise documentation.
The WhiteNosie docs or Render's Django Deploy docs will walk you through the process of configuring WhiteNoise to serve your static assets.
This architecture works for most sites, but if you have a very high-traffic site, you might want to explore the django-stores library, which you can use to upload static assets at build-time to something like S3 so that they are served from there and allow your Django app to focus on only serving dynamic (non-static) requests.
Related
I'd like to scrape a javascript website using Scrapy + Splash in Google App Engine. The Splash plugin is a Docker image. Is there any way to use this within Google App Engine? App Engine itself uses a Docker image, but I'm not sure how to load and access a secondary image (which is how Splash is used). Here are the Splash install instructions
You can use Custom Runtimes in the App Engine Flexible Environment.
Custom runtimes let you build apps that run in an environment
defined by a Dockerfile. By using a Dockerfile, you can use languages
and packages that are not part of the Google Cloud Platform and use
the same resources and tooling that are used in the App Engine
flexible environment.
Explore more About Custom Runtimes. Please note when you use a custom runtime, you have to write your application code to deal with some flexible environment life-cycle and health checking requests. Check how to build a custom runtime for more information.
Deploying the Splash service separately is the proper way to accomplish this.
I went ahead and tested a few different setups and the only approach that allowed me to have Splash on App Engine was to deploy it as a custom domain, setting the forwarded_ports to able to connect directly to one of the service’s instances through its IP address.
This is clearly not an adequate solution, as it comes with many limitations and, in the end, it becomes basically using Google Compute Engine without all the control it provides.
My suggestion is that you only deploy the Scrapy service of your application to App Engine, and leave the Splash service somewhere else, like in a GCE instance.
Once you have that, all you will need to do is set a static IP address for the instance and connect to it from your App Engine app through that.
I have very important query regarding cowboy_static
{"/api/assets/[...]",cowboy_static, {dir,"/home/upload_dir/"}},
{"/api/assets/[...]",cowboy_static, {dir,"/home/upload_dir/"}},
Everything is working fine but I failed to send a default image (for example not_available.jpg) for 404 .
Is it possible in cowboy_static to send a default image if request image/URL not found.
Thanks in advance.
I do not think there is a way of doing it with just cowboy_static handler. The documentation (static files) says
Cowboy comes with a ready to use handler for serving static files. It
is provided as a convenience for serving files during development.
For systems in production, consider using one of the many Content Distribution Network > (CDN) available on the market, as they are the best solution for serving files.
so some functionality may be missing there. If you really want to serve 404 custom page from Cowboy, I think the only option is a custom handler instead of cowboy_static.
I am developing a service layer app which provides a catalog of webservices, then I am orchestrating them using OpenESB.
I create my BPELs importing external WSDL definitions using http://localhost:8080/services/myService?wsdl.
The problem is -- these BPELs strongly depend on this specific URL, and when I deploy on production server, my ESB layer stops working.
How can I make my BPELs independent of the specific endpoint? Can I refer the URIs to an external config file?
To do it you must create application configuration and application variable and add them on your http address. Example: "http://${MyHtttpAddress}:${MyHttpPort}/service1/myService?wsdl"/>.
Applications and variable are set up in the administrative console and can be changed for each environment.
Regards
Paul
So I just finished the railstutorial.org twitter clone example and I want to put it online with my web hosting provider bluehost. Right now all I have is a file called sample_app with all of the rails stuff in it. And it works fine when I visit it on localhost:3000.
So I go to my bluehost file manager and there are 9 different folders, like public_html, public_ftp, rails_apps, www, tmp, access_logs, ect. Ive uploaded sample_app into this overall directory and into the public_html directory itself. But when I visit my website it just displays the html in a default.html file in the public_html directory.
What exactly is telling my hosting service to use public_html/default.html of any of the hundereds of different files and folders that are in other places on my server space? How do I find this thing and tell it to instead use sample_app or public_html/sample_app and then process everything in that to display my rails application?
Ive tried using bluehost support and they emailed me and said this would be accomplished by creating a symlink which links ~/rails_apps/NinetyNine/public to ~/public_html. I have no idea how to do this and the guides I find online all tell me to enter a series of commands. I dont know whether to do this in a terminal on my ubuntu system or some command prompt that bluehost provides. If it is at a terminal on my system which directory should I be in? any attempts I have made on my system have resulted in a no such file or directory error. When I asked bluehost to explain this they said that this was outside of the scope of their support and had to do with web development not hosting. It struck me as odd that they were unwilling to explain their own response to my problem but whatever.
If anyone of you could help me or point me in the right direction I would very much appreciate it. Thank you
What is telling my hosting service to use public_html/default.html ?
That would be a setting the web server configuration, probably Apache.
In Apache's case, the public_html directory is usually enabled with the
UserDir directive.
The default.html, is also an Apache configuration, DirectoryIndex.
Answering these because you asked: but typically, the global Apache configuration
is maintained by your provider (though you usually have some means to customize
parts of it).
Create the symlink from public_html to
They like gave you a command like (maybe not exactly)
$ ln -s ~/rails_apps/NinetyNine/public public_html
That is something that is intended to be run on your webhost, from a command prompt,
at the top of your home directory.
Look for docs on bluehost for finding out how to get SSH shell access.
That's where you'll enter the command.
More generally, however, you want to make sure you read the docs on how your
provider wants you to upload applications. Bluehost seems to have very nice
docs here:
https://my.bluehost.com/cgi/help/rails
Why your hosting provided said it was out of scope.
You're a beginner, and that's officially OK. Welcome!
But if you asked them a question like "Do I enter these commands on my computer
or yours", they are definitely going to politely respond that this out of scope;
meaning -- "We can't hand-hold you through this". If you ran a gas station and
someone asked you how to use the pump, you'd tell them. But if they then asked
"OK but do I put the gas in my car or yours?" you'd be reluctant to answer, because
there's some fundamental missing.
So how do I get more pointers, directions on this stuff?
Lots of approaches. By the far the best is to do as much stuff as you can on
your own computer. In your case, you could easily set up your own Apache
(Macs and Linux frequently ship with it - readily installable on Windows), and
that would clear up a lot of the conceptual issues.
Good luck!
I have been able to build rabbitmq server on ubuntu linux. It came already prepackaged and on making, it is able to start as a service. When i got the client source, i failed to make because it appeared like it needed a folder called ./deps/rabbitmq-server. Analysing the code, i find that the author of the client was accessing the same header files as are found in the server, using include_lib("path to rabbit.hrl e.t.c") in his header file called "amqp_client.hrl". I then decided to add rabbitmq_server in the lib dir of erlang so as its paths are automatically added on start up of the vm. But still this didnot help. There is also another folder which the client references called "rabbit_common" for an include folder he assumes would contain all the .hrl files there. Please assist me in building both the client and server on my ubuntu server, for testing.
Also, if anyone has used RabbitMQ server for IMs, please provide some benchmarks and/or your findings on its throughput, speed and number of users. How can it be compared to ejabberd?. How can one create AJAX/Jquery/Javascript clients for Web functionality?
thanks
I hope you had made some progress as far as RabbitMQ and ejabberd are concerned.
Below is a link to an interesting discussion that might be of help.
http://old.nabble.com/AMPQ-vs-XMPP-and-RabbitMQ-vs-ejabberd-td17587109.html