Should I deploy only the .pyc files on server if I worry about code security?
Deploying .pyc files will not always work. If using Apache/mod_wsgi for example, at least the WSGI script file still needs to be straight Python code.
Some web frameworks also may require the original source code files to be available. Using .pyc files also does little to obscure any sensitive information that may be in templates used by a web framework.
In general, using .pyc files is a very weak defence and tools are available to reverse engineer them to extract information from them.
So technically your application may run, but it would not be regarded as very secure way of protecting your source code.
You are better of using a hosting service you trust. This generally means paying for reputable hosting rather than just the cheapest one you can find.
I want to deploy a Django application to a cloud computing environment, but I am worried about source code security. Can I deploy only the compiled .pyc files there? According to official python doc, pyc files are 'moderately hard to reverse engineer'.
What are the pros and cons of taking this approach? Is this a standard practice?
I am not using AWS, let me just say that I am in a country where cloud computing can not be trusted at all...